Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob,
I copied and pasted the 2 macros you provided in the WORKBOOK module. It gave me an error message "invalid Outside procedure". It high-lighted the "ReDim OldRng(20)" Can you please take a look again? Thanks. Regards, DAA -----Original Message----- Hi DAA, Excel also provides workbook wide sheet events. So put this code in the ThisWorkbook code module Public OldRng Private Sub Workbook_Open() ReDim OldRng(20) 'allow for upto 20 worksheets End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Dim ThisRng On Error Resume Next Set ThisRng = OldRng(Sh.Index) If Not ThisRng Is Nothing Then ThisRng.Interior.ColorIndex = xlNone End If Target.Interior.ColorIndex = 6 Set OldRng(Sh.Index) = Target End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "DAA" wrote in message ... The macro below changes the cell pointer color. However, it only works on A sheet in a workbook. I need the macro to work in ALL the sheets in the workbook without pasting the macro on all worksheet modules. Public OldRng As Range Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not OldRng Is Nothing Then OldRng.Interior.ColorIndex = xlNone End If Target.Interior.ColorIndex = 6 Set OldRng = Target End Sub Please edit MACRO to work on all sheets. Thanks . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Record Macro and Edit Macro options disabled | New Users to Excel | |||
Protect but Allow Edit Ranges in Multiple Sheets | Excel Discussion (Misc queries) | |||
Edit Sheets in Excel Addin | Excel Discussion (Misc queries) | |||
I cannot edit work sheets on excel but i can view them. | Excel Worksheet Functions | |||
Emailing Sheets Code Edit | Excel Programming |