Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
writing coloured text with formulas
I am using the code below to save the time (time5.text) in a cell. It is all
working fine. What I want to do is put an if statement in that when certain criteria are met the same value etc gets written but in blue coloured text in the spreadsheet. Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Something along the lines of If blah blah is true Then Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1).forecolor = vbblue Endif Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
writing coloured text with formulas
Range("B6").Font.ColorIndex = 5
If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I am using the code below to save the time (time5.text) in a cell. It is all working fine. What I want to do is put an if statement in that when certain criteria are met the same value etc gets written but in blue coloured text in the spreadsheet. Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Something along the lines of If blah blah is true Then Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1).forecolor = vbblue Endif Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
writing coloured text with formulas
Hi,
the line would be Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1).Font.ColorIndex = 5 You can use the Font.Color or the Font.ColorIndex method, you get more colors to "easily" choose from if you use the ColorIndex. The best idea is to turn on the recorder and change to font color of a cell and then turn the macro recorder off and see what the color index was that got recorded. 5 above gives a blue. When using vbBlue type arguments you have only 8 colors to choose from When using the ColorIndex method there are 56 but if you want more than you can use Range("A1").Font.Color = RGB(255, 0, 0) Which gives you access to 16 million but of course you need to know the appropriate values. -- If this helps, please click the Yes button. Cheers, Shane Devenshire "NDBC" wrote: I am using the code below to save the time (time5.text) in a cell. It is all working fine. What I want to do is put an if statement in that when certain criteria are met the same value etc gets written but in blue coloured text in the spreadsheet. Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Something along the lines of If blah blah is true Then Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1) = Time5.Text Range("G" & riderCell.Row).End(xlToRight).Offset(0, 1).forecolor = vbblue Endif Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
writing formulas | New Users to Excel | |||
Counting Coloured Text | Excel Discussion (Misc queries) | |||
Coloured text | Excel Discussion (Misc queries) | |||
writing if formulas | Excel Worksheet Functions | |||
Writing Formulas | Excel Worksheet Functions |