I need help in using a macro for my workbook. Basically I have rows that gets automatically added by another macro. Every time a new row is added, The corresponding column has a True/False if formula. When the "False" result of the cell automatically updates to "True", I want the same row to be highlighted in a color and only this row. To further explain,
- Range("B3:K3") is the row I want highlighted when cell ("O3") data changes to "True"
- I have multiple rows that I need this macro to automatically run when the specific cell of column "O" turns from False to True via If formula
- I also have another macro that adds an additional row to the list, so I cannot use conditional formatting
So sometimes I want Range("B19:K19") to be highlighted when cell ("O19") automatically changes. A few things to keep in mind
- I am using an "auto refresh time clock" that basically links to cell ("S11")
- In other words, the cells in Column O is saying (If the corresponding cell from column G [This is the date the task was entered] is over 24 hours old compared to the current time (cell "S11") then change value from False to True.
My only problem is, I cannot seem to get a working macro where it will highlight the row [Range(B3:K3)] of where the False/True data originates [corresponding cells on column O].
Can anyone help me with this?
EDIT Here is what I am trying to accomplish, but cannot get it to work.
Private Sub Worksheet_change(ByVal Target As Range)
Dim Cl As Range
Dim R As Long
Set Cl = TargetAddress
R = Cl.Row
If Target.Address(, "O") = True Then
Target.Range("B" & R, Range("K" & R)).Interior.ColorIndex = 10
Else: Range("B5:K5").Interior.ColorIndex = 1
End If
End Sub
worksheet_change
event. This gets triggered when either user input or VBA makes changes to the sheet. – Luuklag