我想删除名称以“ at 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

最佳答案

Sheets(Left("Data as at", 10)).Delete

SheetExists.Delete

10-06 00:33