View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How do I unprotect/with password to run marco and protect

Try something like

ThisWorkbook.Worksheets("Sheet1").Unprotect Password:="whatever"
' sort
ThisWorkbook.Worksheets("Sheet1").Protect Password:="whatever"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



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