MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Visual Row Highlight


Posted by David on February 01, 2002 4:28 PM

Is there an Add-In out there that would hightlight the entire row for a visual reference righ-to-left?


Posted by Richard Winfield on February 01, 2002 6:20 PM

Right click on the worksheet tab and choose view code. Paste the following in when the VB editor comes up.

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

What this does is highlight the row that the active cell is in with a shade of blue. If you want the column and row both highlighted then add this above the End Sub:

Target.EntireColumn.Interior.ColorIndex = 8

Rick

Posted by David on February 01, 2002 6:34 PM

Color Index

Perfect, just what I'm looking for. Do you have a list of complete color index numbers with colors and how can I have this on all spreadsheets I work on.

Thanks,
David

Posted by Bariloche on February 01, 2002 7:40 PM

Re: Color Index

David,

Run this subroutine and you'll get a listing of the colors and their index numbers for the colors on your pallette.

Sub ColorIndices()

For i = 1 To 56
Cells(i, 1).Interior.ColorIndex = i
Cells(i, 2).Value = i
Next i

End Sub


The operative words are "on your pallette." That's because you can change colors and their locations (index numbers) by going to Tools > Options > Color and modifying the shades available to you.


have fun

Posted by Richard Winfield on February 02, 2002 9:42 AM

Re: Color Index

David to get it to run on all of your workbooks, open each workbook and right click on the Excel icon next to FILE on the toolbar. Choose View Code and then paste the following in:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Cells.Interior.ColorIndex = -4142
Target.EntireRow.Interior.ColorIndex = 8
End Sub

This will make it available to every worksheet in that workbook.
Glad it does what you wanted it to :)
Rick