Protect Sheet - VB code to specify password

D

Darin Kramer

Howdie,

Sheets("A").protect is how to protect a sheet, and similar
Sheets("B").Unprotect.
I run a Macro that first unprotects a sheet, then when Macro is finished
Re protects the sheet.

I want to now specify a password, lets say ABC.
Whats the VB to do that....?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
 
X

Xcelion

Hi Darin,

Sheet("B").Unprotect "ABC"
assuming "ABC" is your password

Thanks
Xcelion
 
M

Mauro Gamberini

Public sub yourMacro()

Shetts("A").Unprotect "ABC"
'Your code
Sheets("A").Protect "ABC"

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