Sandra Smith
asked on
Use RGB to color a font in cell
This company is rebradning all their workbooks, but the colors are all over the place so cannot use the color index to be sure that a field is a particular color. I need to be able to set the color of the font for cell N5 in each workbook a dark blue or grey - anything that is dark and readable, but I can't seem to get the RGB to work.
For Each wks In Worksheets
If Not wks.Name = "Table_of_Contents" And Not wks.Name = "DataSource" Then
wks.Activate
wks.Range("N5").Select
wks.Range("N5").Font.Color = RGB(0, 0, 0)
wks.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"Table_of_Contents!A1", TextToDisplay:="TOC"
End If
Next
ASKER
Sorry I was not clear. I want to use the RGB function to be sure the color of the font in cell N5 on all worksheet is, say, dark blue. But the code does not change the font color, it is still the sick green, which is in the color index.
Did you tryed like this?
jppinto
jppinto
For Each wks In Worksheets
If wks.Name <> "Table_of_Contents" And wks.Name <> "DataSource" Then
wks.Activate
wks.Range("N5").Select
wks.Range("N5").Font.Color = RGB(0, 0, 0)
wks.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"Table_of_Contents!A1", TextToDisplay:="TOC"
End If
Next
Which version of Excel are you using? It is much easier to change a color in Excel 2007 and later than in Excel 2003.
To get the desired RGB color, I suggest the following procedure (Excel 2007 and later):
1) In a blank cell, open the Home...Fill menu item and choose More Colors from the resulting dialog
2) On the Custom tab of the next dialog, choose the desired gray on the right-hand side. Copy down the RGB settings that you see. The one I picked was RGB(117,117,117)
To get the desired RGB color, I suggest the following procedure (Excel 2007 and later):
1) In a blank cell, open the Home...Fill menu item and choose More Colors from the resulting dialog
2) On the Custom tab of the next dialog, choose the desired gray on the right-hand side. Copy down the RGB settings that you see. The one I picked was RGB(117,117,117)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry it took so long to get back but been really busy. Yes, the easies was to just change the hyperlink as mentioned and that worked the best. I split as it took me such a whiel to get back that I would like to give credit to the second person that gave me bascially the same advice. I did try VBA coding, but it just balked, but the hyperlink modification worked.
http://www.mvps.org/dmcritchie/excel/colors.htm
http://www.cpearson.com/excel/colors.aspx
Hope that they can help you.
jppinto