MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Highlight entire row when cell selected


Posted by Mario on January 24, 2002 2:56 PM

I have a worksheet with 36 fields and over 800 rows.
I would like to be able to highlite, shade or border the entire row when a cell is selected in that row (not exactly the same as the selected cell of course) so that it is easier to read as well as enter data. Is there a way? Thanks


Posted by Barrie Davidson on January 24, 2002 3:00 PM

Try pasting this code in to the worksheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Cells.Interior.ColorIndex = -4142
With Target.EntireRow.Interior
.ColorIndex = 6
End With
End Sub


Note, this will slow down your movement and calculations.

Regards,
BarrieBarrie Davidson

Posted by Mario on January 24, 2002 3:38 PM

Forgive my ignorance but how or where do I "paste"
this formula? Thanks again.

Posted by Mario on January 24, 2002 6:18 PM

Forgive my ignorance but how or where do I paste this code on my worksheet? Thanks again.

Posted by Bariloche on January 24, 2002 7:02 PM

Mario,

Right click on the sheet tab and select "View Code". A code sheet will pop up. Paste the code in there.

enjoy

Posted by Steve Riedmueller on January 25, 2002 7:52 AM

Note it will also destroy any of your 'highlighting' that you may put into the worksheet.

Sr : I have a worksheet with 36 fields and over 800 rows.

Posted by Barrie Davidson on January 25, 2002 8:20 AM

Good point, thanks (nt)

Sr

Posted by Mario on January 27, 2002 3:14 PM

Right click on the sheet tab and select "View Code". A code sheet will pop up. Paste the code in there. enjoy

Thanks, It works but you were right about slowing the movement down. Unfortunatly it is too slow to be practical now. Thanks anyway.