Reputation: 9
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,
So sometimes I want Range("B19:K19") to be highlighted when cell ("O19") automatically changes. A few things to keep in mind
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
Upvotes: 0
Views: 1250
Reputation: 1
I think condition formatting can do what you are requiring.
To make it simple, I assume there are only 3 column and 10 rows in your worksheet. Column A is the column your want to be highlighted and column C is the column that has a True/False value. First, select a1:a10, click condition formatting, and then click new rule. Click “Use a formula to determine which cells to format” in next window, and type =C1=True in the formula field. Click the Format bottom on lower right corner to select the color you need, click ok to finish the job.
Upvotes: 0