ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFilter on a protected worksheet (https://www.excelbanter.com/excel-programming/393320-autofilter-protected-worksheet.html)

ADK

AutoFilter on a protected worksheet
 
I have two worksheets which I have defined the columns with AutoFilter. I
have the sheets protected. When a user opens the sheet they can use those
predefined filters. I currently have the following code in WorkBook_Open. Is
this code even required ...if so is what I have correct?

Occasionally, the AutoFilter pull-downs stop working for some reason.
Current fix is to exit workbook and re-open it ....Auto-filters are fine

Using Excel 2000


Private Sub Workbook_Open()
On Error GoTo addError
With Worksheets("PDSR")
If Not .AutoFilterMode Then
.Unprotect Password:="12345"
.Range("A6:D6").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="12345", _
Contents:=True, UserInterfaceOnly:=True
End With
With Worksheets("CompletionTable")
If Not .AutoFilterMode Then
.Unprotect Password:="12345"
.Range("C6:I6").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="12345", _
Contents:=True, UserInterfaceOnly:=True




All times are GMT +1. The time now is 07:10 AM.

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