Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell color
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell color
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell color
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. Johan;703659 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. -- 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/sh...d.php?t=196874 http://www.thecodecage.com/forumz |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to change color of tab based on color of cell | Excel Programming | |||
Excel: Syntax to change cell color based on color of another cell | Excel Worksheet Functions | |||
change fill color of a range of cells based on color of a cell? | Excel Programming | |||
How to change the default Border, Font Color, and Cell Color | Excel Discussion (Misc queries) | |||
Browse Forms Controls and change TextBox color based on cell color | Excel Programming |