Thread: Use AutoFilter
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Use AutoFilter

You cannot change the sheet protection attributes without unprotecting the sheet
first.

To use Autofilter on a protected sheet you must have Autofilter set up prior to
protecting the sheet.

Your open code must unprotect the sheet, select a range then
DataFilterAutofilter then re-protect with the "use autofilter" enabled.

Sub Workbook_Open()
Sheets("Sheet1").Select
With ActiveSheet
.Unprotect Password:="justme"
.Range("A1:F1").Select
Selection.AutoFilter
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True _
, AllowFiltering:=True
End With
End Sub


Gord Dibben MS Excel MVP


On Mon, 3 Mar 2008 16:37:01 -0800, Rafi wrote:

Thanks for your response; I think I need to better explain the situation. I
have a protected excel file posted to a SharePoint server and I want to make
sure that the users will be able to use the autofilters without having to
unprotect the file. So my idea was to write a macro that will execute on
openning of te file to enable the use of AutoFilters onn a protected sheeet.