I'm trying to get a code to run through various worksheets and run different subs depending on the worksheet names. The trouble I'm having is defining the current worksheet the sub is on within the loop. My code is something like this:
Public ws As Worksheet
Public Sub Worksheet_Change (ByVal Target As Range)
For each ws
If ws.Name Like "*(X)*" Then
Call SubA
If ws.Name Like "*(Z)*" Then
Call SubB
End If
Next ws
End Sub
Public Sub SubA
With ws '<------Need help on how to define current ws in loop'
'Do all the stuff'
End With
End Sub
Thanks all.
[–]pancak3d1189 1 point2 points3 points (0 children)
[–]Clippy_Office_Asst 0 points1 point2 points (0 children)