set font color depending on value Range

L

LetMeDoIt

greetings,
simple question (I think). Many thanks for any input on this.

Is there a way using Range to set cells to either red or green
depending on whether they are 5% (red), or less (green). I'm on
office 2003.

I'm currently doing this using the looping logic and that's pretty
slow. I'm hoping the range option will be faster.

If Excel.Range(ActiveCell.Offset(1, 110), _
ActiveCell.Offset(1, 1)).Value >= 0.05 Then

Excel.Range(ActiveCell.Offset(1, 110), _
ActiveCell.Offset(1, 110)).Font.ColorIndex = 3

Else
Excel.Range(ActiveCell.Offset(1, 110), _
ActiveCell.Offset(1, 110)).Font.ColorIndex = 10
End If

regards,
CG
 
B

Bernard Liengme

Have you thought of using conditional formatting as built into Excel?
best wishes
 
L

LetMeDoIt

hhhmmm not sure how conditional setup would be setup in VBA. The
sheets I need to do this are dynamically created.
 
L

LetMeDoIt

thanks for the tip, I looked up conditional formatting. I think I'm
ok from here.

regards,
CG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top