Protect Worksheet While Allowing Autofilter



I've got an Excel file that will be used by people using both Excel 2000 and
Excel 2003. At various points, I have VBA code that protects and unprotects
various sheets. However, these sheets have the AutoFilter option turned on,
and I find that in certain versions, the filters won't work as the sheets
are/aren't protected.

I know that in XL2003 the .Protect method actually allows you to enable
autofiltering, but that is not supported in XL2000.

Is there some other way I can do this?



Dave Peterson

You can modify your code that protects the worksheet:

With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
'.EnableOutlining = True
.EnableAutoFilter = True
End With

(assumes that data|filter has already been applied)

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