As I said you will need to change the references based on your data set up.
The following code will do it, but you could do it manually for ALL rows at
once by selecting all store rows range C4:H104 (say) then setting the
conditional value formula to ="$B4", this will change to B5....B104 as it
ripples down the sheet. Note if you choose B4 when setting the formula
reference it is entered as $B$4 , remove the 2nd absolute ($) reference.
Sub SetConditions()
Dim LastRow As Long, xr As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For xr = 4 To LastRow
With Range(Cells(xr, 3), Cells(xr, 8))
.FormatConditions.Delete
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual,
Formula1:="=$B$" & xr
.FormatConditions(1).Interior.ColorIndex = 4
.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess,
Formula1:="=$B$" & xr
.FormatConditions(2).Interior.ColorIndex = 6
End With
Next xr
End Sub
--
Cheers
Nigel
"greu" wrote in message
...
This macro colors Column B;
i need to color each cell based on a comparaison with the target on
column B
i need to color each cell in the ranges :
C4:H4
C5:H5
..
C9:H9
If i get a macro that works on the file i attached, i will adapt it to
my requirements
--
greu
------------------------------------------------------------------------
greu's Profile:
http://www.excelforum.com/member.php...o&userid=28700
View this thread: http://www.excelforum.com/showthread...hreadid=483837