Pamella
07-25-2019, 11:36 PM
I would like to loop each sheet and perform some action for those sheets that start with REDS.
I have written some code, but erroring.
Sub LoopSheets()
Dim mWB As Workbook
Dim mWS As Worksheet
Dim arySheets
Dim sFile
Dim iSheet As Long
With ActiveWorkbook
'If sFile <> False Then
Set mWB = ActiveWorkbook.Worksheets(I).Name Like "REDS*"
Debug.Print ActiveWorkbook.Worksheets(I).Name
ReDim arySheets(mWB.Worksheets.Count)
For Each oWS In mWB.Worksheets
'''my code here.
Next mWS
End With
End Sub
I have written some code, but erroring.
Sub LoopSheets()
Dim mWB As Workbook
Dim mWS As Worksheet
Dim arySheets
Dim sFile
Dim iSheet As Long
With ActiveWorkbook
'If sFile <> False Then
Set mWB = ActiveWorkbook.Worksheets(I).Name Like "REDS*"
Debug.Print ActiveWorkbook.Worksheets(I).Name
ReDim arySheets(mWB.Worksheets.Count)
For Each oWS In mWB.Worksheets
'''my code here.
Next mWS
End With
End Sub