Re-protect sheet

J

J.W. Aldridge

Code below works fine, but need to re-instate password after changes
are made.

Sub SwitchView_n_protect2()

ActiveSheet.Unprotect Password:="jeremy"
With ActiveSheet.Range("f:f,g:g").EntireColumn
.Hidden = Not .Hidden
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
 
J

john

try this:

Sub SwitchView_n_protect2()

With ActiveSheet

.Unprotect Password:="jeremy"
With .Range("f:f,g:g").EntireColumn
.Hidden = Not .Hidden
End With

.Protect DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
Password:="jeremy"

End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top