Highlight Column When Specific Cells are selected

SuperFantastic

New Member
Joined
Sep 18, 2019
Messages
2
Hey everyone, here's what I'm trying to do. Whenever a cell in row 5 is selected, highlight the column in a specified range. I've used conditional formatting based on a formula, =COLUMN()=CELL("col"), and the following VBA code:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = False Then
Application.Calculate
End If
End Sub
This highlights the correct cells, but it does so when any cell is selected on the sheet. I'd like to highlight the column, only when a cell in row 5 is selected.

Thanks!
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
7,330
Office Version
2019
Platform
Windows
See if changing the formula works

=(COLUMN()=CELL("col"))*(CELL("row")=5)
 

Forum statistics

Threads
1,084,775
Messages
5,379,804
Members
401,629
Latest member
LEMANOIS

Some videos you may like

This Week's Hot Topics

Top