Assigning a color to a cell

  • Thread starter Thread starter Junkyard Engineer
  • Start date Start date
J

Junkyard Engineer

I saw some other post about kind of the same problem but not this way.

I have a risk evaluation formula in a cell. Output range is between 1 and 9

If between 1 and 3, I want to assign the color lightgreen to it
If between 4 and 6 I want to assign the color yellow to it
and red if 7 to 9.

Is this possible within the Function use ? If not, How can I apply that
automatically ? a macro ? How ?
 
Use the Conditional Formatting tool from the Format menu.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
you could define
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("j48").Value > 0 And Range("j48").Value < 4 Then
Range("j48").Interior.ColorIndex = 35
ElseIf Range("j48").Value > 3 And Range("j48").Value < 7 Then
Range("j48").Interior.ColorIndex = 36
Else
Range("j48").Interior.ColorIndex = 3
End If
end sub

on the code of the worksheet and change the argument of Range to the value
of the cell you want

there's probably a much better way to do this, and i'm sure someone will
point it out
 
Ok, that one is interesting because conditional formatting only allows 3
arguments..

thanks
 

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