Previously I had been shown a trick to delete all unprotected cells in my workbook.
The problem is, I want to to skip over a certain sheet, can I skip over a certain sheet with For Each loops?
Sub emptyUnlocked()
Dim ws As Worksheet, bVBProtected As Boolean
For Each ws In Worksheets
If Not ws.ProtectContents Then
ws.Protect
bVBProtected = True
End If
'mikerickson's trick
On Error Resume Next
ws.UsedRange = ""
On Error GoTo 0
If bVBProtected Then
ws.Unprotect
bVBProtected = False
End If
Next ws
End Sub
Bookmarks