How should write the code so that it skips sheet1?
Sub Clear_All()
Dim Ws As Worksheet
For Each Ws In ActiveWorkbook.Worksheets
Ws.Range("A11:F800").ClearContents
Next Ws
End Sub
The standard way would be something like
For Each Ws In ActiveWorkbook.Worksheets
If Ws.Name <> "Sheet1" Then Ws.Range("A11:F800").ClearContents
Next Ws
but, if Sheet1
were already the left-most tab in the workbook then you could do so more simply
Dim i as Long
For i = 2 to Worksheets.Count
Worksheets(i).Range("A11:F800").ClearContents
Next i
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.