Reputation: 11
Here is my situation:
I would like to highlight various columns when I click on any cell in a row based on values in a certain cell of the same row.
Example:
I click on Row 2 --> C2 says "blue" --> Columns B, D, E, F automatically highlights in yellow
Is this possible? (preferably without re-running a macro each time i click on a different row)
Thanks!
Upvotes: 1
Views: 112
Reputation: 27249
Pretty simple VBA, actually. Good luck.
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lngRow As Long, intCol
lngRow = Target.Row
If Cells(lngRow, 3) = "Blue" Then intCol = 6 Else: intCol = 0
Columns(2).Interior.ColorIndex = intCol
Columns(4).Interior.ColorIndex = intCol
Columns(5).Interior.ColorIndex = intCol
Columns(6).Interior.ColorIndex = intCol
End Sub
Upvotes: 1