Macro , Unprotect-Protect -- Atten: Tom Ogilvy

E

Ed

Hi Tom
Thankyou for your help on this yesterday.
I put the following in my macro:

(at the start) Worksheets("abc").Unprotect

(at the end) Worksheets("abc").Protect

Basicly this works fine with one major problem.
You can't protect the sheet with a password.
If you do, you have to enter the password befor you can
run the macro. Then the password protection is gone.

What I need is this. After the above macro is run, I
need not only the sheet to be protected but still be
protected with a password. So that only the person that
knows the password can change a cell. That person being me.

Can this be done?
Thankyou
Ed
 
R

Ron de Bruin

Hi Ed

Look in the VBA help for Protect
You can use a password in your code

Worksheets("abc").Protect Password:="password"
 
T

Tom Ogilvy

Worksheets("abc").Unprotect Password:="ABCD"

Worksheets("abc").Protect Password:="ABCD"
 
E

Ed

Thanks Tom and Ron
Works Great.
Ed
-----Original Message-----
Worksheets("abc").Unprotect Password:="ABCD"

Worksheets("abc").Protect Password:="ABCD"

--
Regards,
Tom Ogilvy






.
 

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