Re-protect sheet

  • Thread starter Thread starter J.W. Aldridge
  • Start date Start date
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
 
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
 
Back
Top