Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,538
- Office Version
- 365
- 2016
- Platform
- Windows
This code:
Breaks with an error when it it is unable to find Worksheets(arr(g). Obviously, I have the error checking in the wrong position. I tried putting the error checking lines before and after the With/End With, it worked, but it still cycled through.
Code:
For g = 0 To UBound(arr)
With Worksheets(arr(g))
Application.DisplayAlerts = False
On Error Resume Next
MsgBox (arr(g)) & " will be deleted"
ThisWorkbook.Sheets(arr(g)).Delete
On Error GoTo 0
Application.DisplayAlerts = True
End With
Next g
Breaks with an error when it it is unable to find Worksheets(arr(g). Obviously, I have the error checking in the wrong position. I tried putting the error checking lines before and after the With/End With, it worked, but it still cycled through.