Reputation: 1419
I want to delete a sheet where the name starts with "data as at". I've used the following but not working.
For Each SheetExists In Worksheets
If Left(SheetExists.Name, 10) = "Data as at" Then
Application.DisplayAlerts = False
Sheets(Left("Data as at", 10)).Delete
Application.DisplayAlerts = True
Exit For
End If
Next SheetExists
It comes back with a subscript error for the following line.
Sheets(Left("Data as at", 10)).Delete
Upvotes: 2
Views: 6451