If sheet name contains 'A' run macro1, if 'B' run macro 2?
Hi, Dan-
This code will do it:
Sub AllTabs()
Dim SheetName
For Each SheetName In Sheets
If InStr(1, SheetName.Name, "A") 0 Then
Macro_A
goto ReStart:
end if
If InStr(1, SheetName.Name, "B") 0 Then
Macro_B
goto ReStart:
end if
ReStart:
Next SheetName
End Sub
Substitute your macro names for Macro_A and Macro_B.
This code will run against ALL tabs in the workbook, and hidden tabs
may cause a runtime error.
Dave O
|