color formatting from vbe
You could use Conditional Formatting, but with VBA:
Sub color_them()
For Each r In ActiveSheet.UsedRange
v = r.Value
If v = 1 Then
r.Interior.ColorIndex = 3
Else
If v = 2 Then
r.Interior.ColorIndex = 5
End If
End If
Next
End Sub
--
Gary''s Student - gsnu200788
"N+" wrote:
hi all.. i need to make the macro to format all the cells of my workbook like
this...
if cell is equal to 2 then
paint it red
end if
if cell is equal to 1 then
paint it blue
end if
help me !! byyy
|