Highlight Column When Cells In Range Are Active

bhsoundman

Board Regular
Joined
Jul 17, 2010
Messages
50
Office Version
  1. 365
Platform
  1. MacOS
Hi All,

I'm trying to use Conditional Formatting to temporarily highlight multiple columns when any cell in those columns are active.

Getting a single column to do it is working fine with this formula:

=COLUMN()=CELL("col")

The basic set up:

Columns A:J are the columns that need to all highlight simultaneously when any cell in those columns are active.

Possible? Or do I need to use VBA?

Thanks in advance!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I'm not sure about conditional formatting but try this macro. Copy and paste the macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Click on any cell in A:J.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("A:J")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    ActiveSheet.Cells.Interior.ColorIndex = xlNone
    Range("A" & Target.Row).Resize(, 10).Interior.ColorIndex = 6
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
I'm not sure about conditional formatting but try this macro. Copy and paste the macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Click on any cell in A:J.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("A:J")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    ActiveSheet.Cells.Interior.ColorIndex = xlNone
    Range("A" & Target.Row).Resize(, 10).Interior.ColorIndex = 6
    Application.ScreenUpdating = True
End Sub

Thanks so much for your reply. This code is working as you intended, however I'm looking to highlight columns A:J as opposed to the rows. I've tried making this line do it:
Range("A" & Target.Row).Resize(, 10).Interior.ColorIndex = 6
But I'm screwing up the syntax.
 
Upvote 0
Try:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("A:J")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    ActiveSheet.Cells.Interior.ColorIndex = xlNone
    Columns(Target.Column).Interior.ColorIndex = 6
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks so much for your reply. This code is working as you intended, however I'm looking to highlight columns A:J as opposed to the rows. I've tried making this line do it:
Range("A" & Target.Row).Resize(, 10).Interior.ColorIndex = 6
But I'm screwing up the syntax.

Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,225,155
Messages
6,183,218
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top