patriciajlim
New Member
- Joined
- Jul 24, 2020
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
Hi all,
I am trying to write a script that will highlight the cell adjacent to the highlighted cell. Here is what I have come up with but throws an error:
The use case is we have first and last names in two columns and we need both the first and last name cells to be highlighted.
Thanks
I am trying to write a script that will highlight the cell adjacent to the highlighted cell. Here is what I have come up with but throws an error:
VBA Code:
Sub if_highlight()
Dim c As Range
For Each c In Columns("B")
If c.Interior.Color = Excel.XlRgbColor.rgbYellow Then
c.Offset(, 1).Interior.Color = Excel.XlRgbColor.rgbYellow
End If
Next c
End Sub
The use case is we have first and last names in two columns and we need both the first and last name cells to be highlighted.
Thanks