Tronsliver
Technical User
I would like to fill a cells color with either red, yellow, blue, or green based on the value of the cell. For example here is a function that is called from elsewhere in my program: Based on the value of "p" at the end of the function I would like to color the cells. If p is between 1-5 the color would be green if between 6 - 10 the cell's color would be yellow...etc Thank you
Public Function FindMLR1(x)
Dim y, z, m, p As Integer
p = 0
y = Cells(x, "B".Value
z = Cells(x, "C".Value
If Cells(x, "C".Value = " " Then End
m = (z / y) * 100
If m >= 90 Then
FindMLR1 = 0
Else
Do While m < 90
p = p + 1
z = z + 1
m = (z / y) * 100
Loop
FindMLR1 = p
End If
End Function
Public Function FindMLR1(x)
Dim y, z, m, p As Integer
p = 0
y = Cells(x, "B".Value
z = Cells(x, "C".Value
If Cells(x, "C".Value = " " Then End
m = (z / y) * 100
If m >= 90 Then
FindMLR1 = 0
Else
Do While m < 90
p = p + 1
z = z + 1
m = (z / y) * 100
Loop
FindMLR1 = p
End If
End Function