Highlighting column and row intersection cells?

gaftalik

Well-known Member
Joined
Feb 6, 2003
Messages
521
Office Version
  1. 2016
Platform
  1. Windows
Hi everybody,

Any code or formula to highlight the intersected cells between a column and a row for any selected cell ?

Ex: if i select E25 the cells of column E1:E25 as well as the cells of Row A25:E25 to be highlighted in a certain color , and so on for any selected cell..

Thank you much for your help .
 
I am trying to format cells with colors and they are disappearing after i move my mouse selection, could i do anything about this ?

I am much grateful for your support!
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
i was afraid of that...i just cleared all the colors from the range...

will you be using a color for the row/col highlighting that is different than any other color? if so i'll just reset that color?
 
Upvote 0
Exactly, it's a large table with headers and row titles for which i have to format each separately, could we just let it highlight if cells are not color formatted ? by other means to ignore colored cells?
 
Upvote 0
give this the ole college try...
Note change clrind=42 to whatever colorindex you are using...right now i changed it so you can only use a colorindex and not color constants....

Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range)
 If target.Cells.Count > 1 Then Exit Sub
   Set Rng = Range("A1:Z100")
   clrind = 42
   If Not Intersect(target, Rng) Is Nothing Then
   For Each cell In Rng
        If cell.Interior.ColorIndex = clrind Then cell.Interior.Pattern = xlNone
   Next cell
   For Each cell In Range(Cells(1, target.Column), Cells(target.Row, target.Column))
      If cell.Interior.Pattern = xlNone Then cell.Interior.ColorIndex = clrind
   Next cell
   For Each cell In Range(Cells(target.Row, 1), Cells(target.Row, target.Column))
      If cell.Interior.Pattern = xlNone Then cell.Interior.ColorIndex = clrind
   Next cell
  End If
End Sub
 
Upvote 0
Thats it, but going too slow ?!! is it supposed to be cause i made the range bigger !
 
Upvote 0
how big did you make the range? it could part of the issue b/c it's looping through that whole range to uncolor any previous row/col coloring...
 
Upvote 0
i just changed my range to the same and it is quite slow...let me see if i can figure out a better way than looping all the cells...
 
Upvote 0
Hope i am not buzzing, i was trying to copy a range of cells values and paste it in another row and that was impossible, seems it prevent other formatting operations.
 
Upvote 0

Forum statistics

Threads
1,223,929
Messages
6,175,448
Members
452,642
Latest member
acarrigan

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