![]() |
How can I run a macro in a protected worksheet?
I have a worksheet which I want users to enter a limited amount of
information and then I have a a couple of macros that sorts it for them. How can I run the macro and still protect the worksheet? Any ideas? |
You cannot run a sort macro in a protected sheet, so you have to unprotect,
do the sort, and protect the sheet again. In a similar post, Julie D posted the following: Hi you'll need to uprotect the sheet at the start of the macro and protect it again at the end e.g. sub mymacro() activesheet.unprotect ("pwd") 'current code activesheet.protect ("pwd") end sub where pwd is your password Cheers JulieD "Husker87" wrote: I have a worksheet which I want users to enter a limited amount of information and then I have a a couple of macros that sorts it for them. How can I run the macro and still protect the worksheet? Any ideas? |
Husker
The easiest method is to unprotect, run your code then re-protect. Sub Sort_and_stuff() ActiveSheet.Unprotect Password:="justme" 'do your things or call your macros here ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _ Contents:=True, Scenarios:=True End Sub Gord Dibben Excel MVP On Wed, 30 Mar 2005 10:41:06 -0800, "Husker87" wrote: I have a worksheet which I want users to enter a limited amount of information and then I have a a couple of macros that sorts it for them. How can I run the macro and still protect the worksheet? Any ideas? |
All times are GMT +1. The time now is 05:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com