Password protection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have read a number of questions and answers on password protection on
worksheets however I could not find one with the code I am looking to use.

I have a protected worksheet and when a cmd button is selected the worksheet
is unprotected, action in code performed and then worksheet is protected
again however.....

Is it possible when unprotecting the worksheet from VBA that the sheet is
unprotected without a message coming up asking for the password to be
entered, is it possible to enter the password into the code when unprotecting
and when protecting again in VBA that it protects with the password.

Thanks
Noemi
 
Noemi

Sub SHEETUNPROTECT()
ActiveSheet.Unprotect Password:="justme"

'your code goes here

ActiveSheet.Protect Password:="justme"
End Sub




Hi
I have read a number of questions and answers on password protection on
worksheets however I could not find one with the code I am looking to use.

I have a protected worksheet and when a cmd button is selected the worksheet
is unprotected, action in code performed and then worksheet is protected
again however.....

Is it possible when unprotecting the worksheet from VBA that the sheet is
unprotected without a message coming up asking for the password to be
entered, is it possible to enter the password into the code when unprotecting
and when protecting again in VBA that it protects with the password.

Thanks
Noemi

Gord Dibben MS Excel MVP
 
Back
Top