Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
writing formulas David Cheeks New Users to Excel 2 August 29th 08 12:00 AM
Counting Coloured Text Killer Excel Discussion (Misc queries) 1 June 19th 07 11:24 PM
Coloured text David Crawt[_2_] Excel Discussion (Misc queries) 2 April 23rd 07 10:48 PM
writing if formulas mafarmer Excel Worksheet Functions 1 December 5th 06 03:07 PM
Writing Formulas Irv Excel Worksheet Functions 2 December 28th 04 09:25 PM


All times are GMT +1. The time now is 10:33 PM.

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

About Us

"It's about Microsoft Excel"