to format cells with colors

  • Thread starter Thread starter jp
  • Start date Start date
J

jp

i would like to create a formula in a cell to change the
font colors dependig on the value of the cell, for
instance if the value is less then $100 it should be the
default color, between $100 & $500 it should be red & so
on.
 
Hi jp

if you've got three or less conditions check out conditional formatting,
found under the format menu

otherwise here's a copy & paste from an post by Frank Kabel recently:
----
If you only want to apply different FONT colors based on NUMBERS, you
can define up to 6 different styles. See:
http://www.mcgimpsey.com/excel/conditional6.html
for instructions how to do it

For everything else you'll need VBA code (e.g. process the
worksheet_change event and apply your format based on the cell values).
The following will color the entry in cell A1:A100 based on its value:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A100")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
Select Case .Value
Case "Red": .Interior.ColorIndex = 3
Case "Blue": .Interior.ColorIndex = 10
'etc.
End Select
End With
CleanUp:
Application.EnableEvents = True
End Sub
---
found at (
http://groups.google.com/[email protected]&rnum=1 )

hope this helps
Cheers
JulieD
 

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

Back
Top