Changing font colour for cell variables

S

Sea Urchin

I want to be able to change the font colour in a cell depending upon it's
value in the cell - eg over/under 1000. Presumably the 'IF' function is the
way to go but what do I need to do to get it to change the font colour. Can
anyone help?
 
L

LOFE

If you want to include it in your VBA code, you're right, you would use the
If statement:

If ActiveCell > 1000 Then
Activecell.Font.ColorIndex = 3
Else
Activecell.Font.ColorIndex = 5
End If

Depending on the colours you want, you will either need to use trial and
error (by picking a number and then stepping through the code to see what the
result is), looking up the help or recording a macro and selecting the colour
that you want. Then you can look through what you recorded and get the
colour index.

Hope this helps.
 

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