From: Johan on
How do i write a macro or VBA program that will change the color of a cell
based on set conditions?

eg. if the cell value <20 then change the color to red.
From: Jacob Skaria on
Try the below

With Selection
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND(RC<>"""",RC<20)"
.FormatConditions(1).Interior.ColorIndex = 3
End With

--
Jacob (MVP - Excel)


"Johan" wrote:

> How do i write a macro or VBA program that will change the color of a cell
> based on set conditions?
>
> eg. if the cell value <20 then change the color to red.
From: Simon Lloyd on

It's not a good idea to use vba if you don't have to, Excels own built
in conditional format function is faster and more efficient, although on
very large spreadsheets can cause a problem.


J
o
h
a
n
;
7
0
3
6
5
9

W
r
o
t
e
:


>
How do i write a macro or VBA program that will change the color of a
cell
based on set conditions?

eg. if the cell value <20 then change the color to red.


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?u=1
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=196874

http://www.thecodecage.com/forumz

 | 
Pages: 1
Prev: data splitting
Next: Pivot tables