D
documike
I have a macro that when run changes the color of a row based on a cell
value.
Col A has TRUE & FALSE values and the color of the row changes whether TRUE
or FALSE.
It works fine when I manually run the macro.
I want it to dynamically change whenever one of the cells in Col A changes.
Is this when a LOOP is required? How do I code that? Here is the code I am
currently playing with:
Sub ColorRowBasedOnCellValue()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cell As Range
For Each cell In Intersect(Selection, ActiveCell.EntireColumn, _
ActiveSheet.UsedRange)
Select Case cell.Value
Case Is >= TRUE
cell.EntireRow.Interior.colorindex = 20
Case Is >= FALSE
cell.EntireRow.Interior.colorindex = 37
End Select
Next cell
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
End Sub
value.
Col A has TRUE & FALSE values and the color of the row changes whether TRUE
or FALSE.
It works fine when I manually run the macro.
I want it to dynamically change whenever one of the cells in Col A changes.
Is this when a LOOP is required? How do I code that? Here is the code I am
currently playing with:
Sub ColorRowBasedOnCellValue()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cell As Range
For Each cell In Intersect(Selection, ActiveCell.EntireColumn, _
ActiveSheet.UsedRange)
Select Case cell.Value
Case Is >= TRUE
cell.EntireRow.Interior.colorindex = 20
Case Is >= FALSE
cell.EntireRow.Interior.colorindex = 37
End Select
Next cell
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = False
End Sub