View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Paul B
 
Posts: n/a
Default How can I lock worksheets while macros can still enter into them?

enginguven, you can protect the sheet with user interface only, like this

ActiveSheet.Protect UserInterfaceOnly:=True, password:="123"
or
Sheets("Sheet1").Protect UserInterfaceOnly:=True, Password:="123"

or use something like this

Const PW As String = "123" 'Change Password Here
ActiveSheet.Unprotect Password:=PW
'you code here
ActiveSheet.Protect Password:=PWEnd Sub



--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"enginguven" wrote in message
...
I want to lock worksheets for outside users. But when I do it and a macro
needs to go into the worksheet, the system gives an error. So is there a

way
to lock worksheets while still allowing macros to enter into the sheets

and
function properly?