MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by Bob J on October 25, 2001 9:12 AM

I want to put this code into a click event, maybe a menu.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Cells.Interior.ColorIndex = -4142
If Target.Row = 1 Then Exit Sub
With Target.EntireRow.Interior
.ColorIndex = 6
End With
ActiveCell.Interior.ColorIndex = 43
End sub

The problem is, this way it is on all the time in only one sheet. I want
to use this on the fly in any sheet...Any ideas?

Posted by Bob Umlas on October 25, 2001 9:15 AM

In the VBE, double-click the Thisworkbook object, below the sheets, and enter your code within THIS stub:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)

End Sub
---then it's for all the sheets.