View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
StargateFanFromWork[_4_] StargateFanFromWork[_4_] is offline
external usenet poster
 
Posts: 51
Default Filtering protected sheets (again).

Can we enable filtering more than once so that it still works even after any
toolbar command selected from the floating commandbar re-protects the sheet?

I searched the archives yet again and found 2 messages again both with code
kindly provided by Tom Ogilgy:

Sub AllowFilter()
ActiveSheet.EnableAutoFilter = True
ActiveSheet.Protect UserInterFaceOnly:=True
End Sub

Sub Auto_Open()
With Worksheets("Sheet1")
.EnableAutofilter = True
.Protect UserInterfaceOnly:= True
End With
End Sub

The Auto_Open prompted an idea. I've been using a variation of the first
code above in the ThisWorkbook so that filtering is enabled upon opening the
workbook. Yet the moment any of the commandbar codes are pressed the
filtering then promptly is disabled since each has an "ActiveSheet.Protect"
code at the end. [A corresponding unprotect code is put at the beginning of
each macro so that sorting, etc., can be done. These two codes must
remain.]

So the goal is to find something that can be placed after that
"ActiveSheet.Protect" line in each macro so that the user is allowed to
manually filter the sheet without nullifying the ActiveSheet.Protect. That
would be the crux of the matter, I'm guessing -- whether or not that can be
done? TIA.