Keeping in the same context, but adding more flexibility, I've adapted
the following code example from procedures in my code archives. It
demonstrates a means to include, or exclude, or both...
Sub ProcessSheets(WksList$, Process&, Optional Order& = 1)
' Processes listed sheets as specified by Process
' If Process=2 then the default Order is 1 if omitted
' WksList: String value of sheetnames
' Process: Long value; 0=exclude, 1=include, 2=both
' Order: Long value; 0=exclude followed by include
' 1=include followed by exclude
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
Select Case Process
Case 0: Call Macro0(wks)
Case 1: Call Macro1(wks)
Case 2
Select Case Order
Case 0: Call Macro0(wks): Call Macro1(wks)
Case 1: Call Macro1(wks): Call Macro0(wks)
End Select 'Case Order
End Select 'Case Process
Next 'wks
End Sub
...where the called procedure accepts a ref for the sheet to act on.
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion