我想删除名称以“data as at”开头的工作表。我使用了以下但不工作。
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
它返回以下行的下标错误。
Sheets(Left("Data as at", 10)).Delete