protect sheet blocks filter

B

bob

i have specified a range as unlocked but when i run a macro to copy a sheet
then protect the destination sheet the autofilter function is disabled. can
i use a filter on an unlocked range in a protected sheet.


' unlock filter range
Range("W12:AL12").Select
Selection.Locked = False
Selection.FormulaHidden = False

' add autofilter
Range("W12:AL12").Select
Selection.AutoFilter

're protect data sheet
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

're-protect test WB
ActiveWorkbook.Protect Structure:=True, Windows:=False
 
S

Steven Revell

Hi Bob,

I have a feeling you will need to activate the autofilter.
The following snippet is from the Microsoft Help.

ActiveSheet.EnableAutoFilter = True
ActiveSheet.Protect contents:=True, userInterfaceOnly:=True

HTH

Steven
 
B

bob

thanks for the help
Dave Peterson said:
And .enableautofilter is one of those properties that excel doesn't remember
when you reopen the workbook. I like to put this in Auto_open (or
workbook_open) so that the worksheet is protected the way I want when I open it.
 

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