ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unlocking and Locking in a Marco (https://www.excelbanter.com/excel-programming/413937-unlocking-locking-marco.html)

JBoyer

Unlocking and Locking in a Marco
 
I have a marco that will only work if the sheet is unprotected. Can I make my
marco unlock the sheet in the beginning and then lock it when completed. Hope
you can help!

Mike

Unlocking and Locking in a Marco
 
try this
worksheets("Sheet1").unprotect "password"
'run your code here
worksheets("Sheet1").protect "password"

"JBoyer" wrote:

I have a marco that will only work if the sheet is unprotected. Can I make my
marco unlock the sheet in the beginning and then lock it when completed. Hope
you can help!


JBoyer

Unlocking and Locking in a Marco
 
That's all I needed. THANKS!

"Mike" wrote:

try this
worksheets("Sheet1").unprotect "password"
'run your code here
worksheets("Sheet1").protect "password"

"JBoyer" wrote:

I have a marco that will only work if the sheet is unprotected. Can I make my
marco unlock the sheet in the beginning and then lock it when completed. Hope
you can help!


Mike

Unlocking and Locking in a Marco
 
Your welcome

"JBoyer" wrote:

That's all I needed. THANKS!

"Mike" wrote:

try this
worksheets("Sheet1").unprotect "password"
'run your code here
worksheets("Sheet1").protect "password"

"JBoyer" wrote:

I have a marco that will only work if the sheet is unprotected. Can I make my
marco unlock the sheet in the beginning and then lock it when completed. Hope
you can help!



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

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