Link to home
Start Free TrialLog in
Avatar of surah79
surah79

asked on

EXCEL

HI Guys

Is there any way I can protect the Excel Workbook (Whole ) with a macro and and Unprotect it with a macro
ASKER CERTIFIED SOLUTION
Avatar of MINDSUPERB
MINDSUPERB
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
please try following macros.


Public Sub unlocksheets()
'use it to unlock

On Error Resume Next
ActiveSheet.unprotect password:="ABC"

End Sub
Public Sub locksheet()
'to lock the sheet

On Error Resume Next
ActiveSheet.PROTECT password:="ABC"

End Sub