magmike brought next idea :
On Jan 22, 12:25*am, GS wrote:
That code could probably be put so it better self-documents its
intent...
* *Dim wks As Worksheet
* *For Each wks In ThisWorkbook.Worksheets
* * *If InStr(msSHEETS_TO_EXCLUDE, wks.Name) = 0 Then
* * * *'//code to do stuff to other sheets...
* * *End If
* *Next 'wks
In the '//code to do stuff...' section, would I just name the
procedures here, such as this?:
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If InStr(msSHEETS_TO_EXCLUDE, wks.Name) = 0 Then
Worksheet_Change
End If
Next 'wks
And then include the procedures below this in the ThisWorkbook module?
No! This code would go in the Workbook_SheetChange event. Put the code
that 'does stuff' in a standard module (so there's nothing behind any
sheets), and just 'Call' it from the Workbook_SheetChange event...
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
If InStr(msSHEETS_TO_EXCLUDE, wks.Name) = 0 Then
Call MySubToRunWhenSheetChangeHappens(Sh, Target)
End If
Next 'wks
End Sub
...where you pass a ref to the sheet and the range that was changed.
Your procedure will need to know which sheet to process after checking
if Target is a range you want to use as a trigger to do stuff. If
Target is not a trigger cell then just exit.
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc