ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro , Unprotect-Protect -- Atten: Tom Ogilvy (https://www.excelbanter.com/excel-programming/312031-macro-unprotect-protect-atten-tom-ogilvy.html)

ed

Macro , Unprotect-Protect -- Atten: Tom Ogilvy
 
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

Ron de Bruin

Macro , Unprotect-Protect -- Atten: Tom Ogilvy
 
Hi Ed

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

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



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ed" wrote in message ...
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




Tom Ogilvy

Macro , Unprotect-Protect -- Atten: Tom Ogilvy
 
Worksheets("abc").Unprotect Password:="ABCD"

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

--
Regards,
Tom Ogilvy



"Ed" wrote in message
...
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




ed

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

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

--
Regards,
Tom Ogilvy



"Ed" wrote in message
...
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



.



All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com