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