Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I created a macro in VBA to color rows based on the value of column K in each
row. It works using a test file with the required values typed in. However, in the file that it NEEDS to work in, those values are the result of an IF function. Here is my code, does anybody have any ideas? I think it probably has to do with the way those values are being generated and not the code... Sub Update_Report_Colors() Dim i As Integer i = 11 ' Will color the cells so long as there is a value entered in column K Do While Not IsEmpty(Columns(11).Cells(i)) If ActiveSheet.Columns(11).Cells(i) = "OK" Then 'sets color to green Range(Columns(1).Cells(i), Columns(11).Cells(i)).Select With Selection.Interior .ColorIndex = 4 .Pattern = xlSolid End With End If If ActiveSheet.Columns(11).Cells(i) = "Check $" Then ' sets color to yellow Range(Columns(1).Cells(i), Columns(11).Cells(i)).Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With End If If ActiveSheet.Columns(11).Cells(i) = "#N/A" Then 'sets color to red Range(Columns(1).Cells(i), Columns(11).Cells(i)).Select With Selection.Interior .ColorIndex = 3 .Pattern = xlSolid End With End If i = i + 1 Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem in running a macro from VB6 | Excel Discussion (Misc queries) | |||
macro running problem | Excel Programming | |||
Problem with running macro on Mac computer | Excel Programming | |||
Macro running problem | Excel Discussion (Misc queries) | |||
problem running macro from schedule task | Excel Programming |