Learner123
12-08-2016, 12:50 PM
Hi All,
The below code keeps crashing on me and causes excel to disappear. I don't know why...
Can someone provide some insight??
My tabs are all protected and have password 123. I am trying to run through all the tabs and delete the Allow Users to Edit Ranges.
Sub UNpr()
Dim ws As Worksheet
Dim pwd As String
Dim aer As AllowEditRange
pwd = "123" ' Put your password here
For Each ws In Worksheets
ws.Unprotect Password:=pwd
For Each aer In ws.Protection.AllowEditRanges
aer.Delete
Next aer
Next ws
End Sub
Thanks
The below code keeps crashing on me and causes excel to disappear. I don't know why...
Can someone provide some insight??
My tabs are all protected and have password 123. I am trying to run through all the tabs and delete the Allow Users to Edit Ranges.
Sub UNpr()
Dim ws As Worksheet
Dim pwd As String
Dim aer As AllowEditRange
pwd = "123" ' Put your password here
For Each ws In Worksheets
ws.Unprotect Password:=pwd
For Each aer In ws.Protection.AllowEditRanges
aer.Delete
Next aer
Next ws
End Sub
Thanks