ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect Worksheet While Allowing Autofilter (https://www.excelbanter.com/excel-programming/375620-protect-worksheet-while-allowing-autofilter.html)

MDW

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?
--
Hmm...they have the Internet on COMPUTERS now!

Dave Peterson

Protect Worksheet While Allowing Autofilter
 
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)


MDW wrote:

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?
--
Hmm...they have the Internet on COMPUTERS now!


--

Dave Peterson


All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com