brookementer
New Member
- Joined
- Jun 3, 2019
- Messages
- 2
Hello, I have a button running three macros. I was to have this run through multiple sheets in a workbook, but not all the sheets. Just selected sheets. I have this code on the button. It seems to run through and select the sheets as the message box pops up. But it is not actually running the macros on the non-active sheets. (please excuse me if I am not clear, this is my first post to this forum). Any suggestions would be so appreciated. Thank you, Brooke
Sub Button1_Click()
Dim WkSheets As Variant, SheetName As Variant, ws As Worksheet
'** SET The Sheet Names - MUST Reflect Each Sheet Name Exactly!
WkSheets = Array("ATC1", "BEC1", "DKC1")
For Each SheetName In WkSheets
MsgBox SheetName
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = SheetName Then
Call CheckGoalSeekRev 'Macro1
Call CheckGoalSeekCos 'Macro2
Call gsMultiCols 'Macro3
End If
Next
Next
End Sub
Sub Button1_Click()
Dim WkSheets As Variant, SheetName As Variant, ws As Worksheet
'** SET The Sheet Names - MUST Reflect Each Sheet Name Exactly!
WkSheets = Array("ATC1", "BEC1", "DKC1")
For Each SheetName In WkSheets
MsgBox SheetName
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = SheetName Then
Call CheckGoalSeekRev 'Macro1
Call CheckGoalSeekCos 'Macro2
Call gsMultiCols 'Macro3
End If
Next
Next
End Sub