ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning a color to a cell (https://www.excelbanter.com/excel-programming/331076-assigning-color-cell.html)

Junkyard Engineer

Assigning a color to a cell
 
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 ?



Chip Pearson

Assigning a color to a cell
 
Use the Conditional Formatting tool from the Format menu.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Junkyard Engineer" wrote in
message ...
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 ?





Gixxer_J_97[_2_]

Assigning a color to a cell
 
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

"Junkyard Engineer" wrote:

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 ?




Junkyard Engineer

Assigning a color to a cell
 
Ok, that one is interesting because conditional formatting only allows 3
arguments..

thanks

"Gixxer_J_97" a écrit dans le message
de ...
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

"Junkyard Engineer" wrote:

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 ?







All times are GMT +1. The time now is 09:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com