I'm not sure exactly what you are looking for, but hopefully the following code I used for another project will be of some help.
I linked this to a button click and used it to color a range of cells, based on their values. Hopefully it will help steer you in the right direction.
arrCells is an array of the Cell Columns "C" through "AW" or something.
dbNil, dbPoorLow, dbFairLow and dbGood are values that I set elsewhere to compare against.
intNul, intPoor, intFair and intGood are integers holding the various color numbers.
Public Sub colorCells()
For intRow = 9 To 15
If intRow = 12 Then
intRow = 13
End If
For intCol = 3 To 40
Range(arrCells(intCol) & intRow).Select
dblNumber = Val(Selection.Text)
If dblNumber < dblNil Then
Selection.Interior.ColorIndex = intNil
End If
If dblNumber >= dblPoorLow And dblNumber < dblPoorHigh Then
Selection.Interior.ColorIndex = intPoor
End If
If dblNumber >= dblFairLow And dblNumber < dblFairHigh Then
Selection.Interior.ColorIndex = intFair
End If
If dblNumber >= dblGood Then
Selection.Interior.ColorIndex = intGood
End If
Next intCol
Next intRow
End Sub
Mike
Mike
EchoVue.com
|