A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to color characters REG, GREEN, YELLOW in the same cell?



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2004, 01:24 AM
Bob Hillier
external usenet poster
 
Posts: n/a
Default How to color characters REG, GREEN, YELLOW in the same cell?

I have seen the VB code that will count cells with a specific color.
I have seen the VB code that will set the font color of all characters in a
cell.
What is the VB code that sets the colour of individual characters in a cell?
For example:
What is the VB code to set 5 characters GREEN,
2 characters YELLOW and 3 characters RED in the same cell?

Why would I want to do this?...

I have 10 project deliverable tasks grouped with the summary task at the
top. Each deliverable task has a status colour assigned (GREEN, YELLOW,
RED). The group summary line has a status cell filled with 10 # characters.
Each # character is to be coloured the colour of one of the 10 deliverable
task's status. This results in what looks like a colour bar showing the
status of all the tasks in the group.

Now, I manually count the number of GREEN, YELLOW and RED cells in a range.
I manually select the correct number of # characters in the summary status
cell and color them GREEN, YELLOW and RED as required. This produces a
visual color bar on the summary line.... manually. (I actually have 112
tasks across 11 function areas and this manual approach is slow, tedious and
error prone.)

How can I automate this with VB code?

Thank you for any suggestions.

Bob



  #2  
Old February 10th, 2004, 09:12 AM
Frank Kabel
external usenet poster
 
Posts: n/a
Default How to color characters REG, GREEN, YELLOW in the same cell?

Hi Bob
you can use the 'characters' object for this. e.g.
With Worksheets("Sheet1").Range("A1")
.Value = "teststringteststring"
.Characters(1, 5).Font.colorindex = 10
.Characters(6, 3).Font.colorindex = 3
End With

Frank

Bob Hillier wrote:
I have seen the VB code that will count cells with a specific color.
I have seen the VB code that will set the font color of all
characters in a cell.
What is the VB code that sets the colour of individual characters in
a cell? For example:
What is the VB code to set 5 characters GREEN,
2 characters YELLOW and 3 characters RED in the same cell?

Why would I want to do this?...

I have 10 project deliverable tasks grouped with the summary task at
the top. Each deliverable task has a status colour assigned (GREEN,
YELLOW, RED). The group summary line has a status cell filled with 10
# characters. Each # character is to be coloured the colour of one of
the 10 deliverable task's status. This results in what looks like a
colour bar showing the status of all the tasks in the group.

Now, I manually count the number of GREEN, YELLOW and RED cells in a
range. I manually select the correct number of # characters in the
summary status cell and color them GREEN, YELLOW and RED as required.
This produces a visual color bar on the summary line.... manually. (I
actually have 112 tasks across 11 function areas and this manual
approach is slow, tedious and error prone.)

How can I automate this with VB code?

Thank you for any suggestions.

Bob



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.