autosorting protected data with macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a set of data that i share with other users and allow them to autosort
through. The data is protected so that the other users cannot corrupt the
data.

I recently wrote some macros that include detailed multilevel autosorts of
the same data. i wrote and tested the macros with no protection and they
function well.

When i reprotect my data and then attempt to run my macro i get a run time
error telling me i cannot do an autosort on a protected sheet on lines like
the one below...

Selection.AutoFilter Field:=8, Criteria1:="0"

Any suggestions ???
 
chuck

See Debra Dalgleish's site for info on why you can't create an autofilter on a
protected sheet.

Also a couple of work-arounds to allow it.

http://www.contextures.com/xlautofilter03.html#Protect




I have a set of data that i share with other users and allow them to autosort
through. The data is protected so that the other users cannot corrupt the
data.

I recently wrote some macros that include detailed multilevel autosorts of
the same data. i wrote and tested the macros with no protection and they
function well.

When i reprotect my data and then attempt to run my macro i get a run time
error telling me i cannot do an autosort on a protected sheet on lines like
the one below...

Selection.AutoFilter Field:=8, Criteria1:="0"

Any suggestions ???

Gord Dibben MS Excel MVP
 
thanks will check it out....
Wonder if i had my macro turn off the protection when it filtered and then
turn it back on after filter if that would resolve my data protection issues?
 
Yes. That would be another method.

Sub Do_Stuff()
ActiveSheet.Unprotect Password:="justme"

'your code here

ActiveSheet.Protect Password:="justme"
End Sub


Gord
 
thanks gord
--
dr chuck


Gord Dibben said:
Yes. That would be another method.

Sub Do_Stuff()
ActiveSheet.Unprotect Password:="justme"

'your code here

ActiveSheet.Protect Password:="justme"
End Sub


Gord
 

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

Back
Top