View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How do I unprotect/with password to run marco and protect

option explicit
sub yourmacro()
activesheet.unprotect password:="topsecret"
'your sort code here
activesheet.protect password:="topsecret"
end sub



J_Will wrote:

I have a locked sheet with columns unlocked for users to populate. I have it
protected with a password so users can only update certain cells. I wrote a
macro to sort data when entries are completed by clicking a button. How can
I unprotect it with password, run macro, and protect it with password after
sort is complete


--

Dave Peterson