View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Spreadsheet Solutions Spreadsheet Solutions is offline
external usenet poster
 
Posts: 33
Default automatically highlight a row when a cell in that row is selected

Dave;
Will this come in handy ?
You can change the color code (15) to your likings (3 = red).
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
'Toggles worksheet colors
'Code will remove all color and color active row and column

If ActiveCell.Interior.ColorIndex < xlNone Then
Cells.Interior.ColorIndex = xlNone
Else
Cells.Interior.ColorIndex = xlNone
ActiveCell.EntireColumn.Interior.ColorIndex = 15
ActiveCell.EntireRow.Interior.ColorIndex = 15
End If

End Sub


--
Regards;
Mark Rosenkrantz
--
Spreadsheet Solutions
Uithoorn
Netherlands
--
E:
W:
www.spreadsheetsolutions.nl
--
"Dave F" wrote in message
...
I imagine this is a pretty simple piece of VBA programming.

I want Excel to automatically highlight a row when I select a cell
from that row. For example, if I select G20, I want row 20 to be
highlighted, say, in yellow.

I'm using Excel 2007 and Windows XP if it matters.

Thanks for the help.