View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Macro Programming with Sorting

ActiveWorkbook.Unprotect Password:="XXXXXXXX" <<<your password
'Do Events
ActiveWorkbook.Protect Password:="XXXXXXXX" <<<your password

"Neon520" wrote:

Hi Everyone,

I'm not sure what is the different Macro and VBA, but I know that once Macro
is recorded, you can do some modification/tweak to it, right?

I recorded a Macro that will Unprotect a sheet and then sorting a section of
the sheet, and then Protect the sheet back with the original password.

First of all, I created this Macro, because Excel won't allow user to Sort
anything after the sheet is locked. I guess it's my way to get around it.
The purpose is to sort the sheet, obviously, without giving the password to
the user, but when I try it out, the sheet still ask for the password. Is
there a way to Hard Code the password in the Macro, so it won't ask for the
password when I run it?

Thank you for any suggestion.
Neon