Hi all,
How can I re-write below code:
If ThisWorkbook.Sheets("IA").ProtectContents = False Then
With ThisWorkbook.Sheets("IA")
.Protect password:="password", UserInterFaceOnly:=True, AllowFormattingColumns:=True
.EnableSelection = xlNoRestrictions
End With
Else
'nothing
End If
to apply it to an array of sheets? I have following array:
Dim Dashboards, sht
Dashboards = Array("Analytics", "Level 4", "Delivery")
and code (see below) to protect them. Though, I don't want to re-protect them if they are already protected. So the code needs to somehow check which sheets in the array are currently unprotected and only (!) protect those. How can I achieve that?
For Each sht In Dashboards
With ThisWorkbook.Sheets(sht)
.Protect password:="password", UserInterFaceOnly:=True, AllowFiltering:=True
.EnableSelection = xlNoRestrictions
End With
Next sht
Bookmarks