Macro Programming with Sorting

N

Neon520

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
 
J

JLGWhiz

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top