Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cells color & cells contains if formula
I'm new to excel vba. I'm tried out the vba code for changing cells
color but it don't work if my cells contains a if formula (eg. all cells in cloumn A contain =if(and(b1="Rej",c1="Rej"),"Rej",....). Any idea what should be the code? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cells color & cells contains if formula
Perhaps this little code snippet will point you in the right direction:
Sub FormulaCellColor() Dim varVal As Variant Dim strCell As String Dim r As Range Range("A1").Select varVal = ActiveCell.Value Do Until varVal = "" Set r = ActiveCell If r.HasFormula Then With r .Interior.Color = vbBlue .Font.Color = vbWhite End With End If ActiveCell.Offset(1).Select Loop Set r = Nothing End Sub -- Kevin Backmann "dot" wrote: I'm new to excel vba. I'm tried out the vba code for changing cells color but it don't work if my cells contains a if formula (eg. all cells in cloumn A contain =if(and(b1="Rej",c1="Rej"),"Rej",....). Any idea what should be the code? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cells won't change font color or show hi-lighted cells in document | Excel Discussion (Misc queries) | |||
change color of all cells with formula or are part of a formula | Excel Discussion (Misc queries) | |||
Change the color of cells having formula. | Excel Discussion (Misc queries) | |||
Change font and background color of several cells based on result of a formula | Excel Discussion (Misc queries) | |||
Change color in cells | Excel Discussion (Misc queries) |