ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoFilter with protected sheets (https://www.excelbanter.com/excel-programming/392617-autofilter-protected-sheets.html)

ADK

AutoFilter with protected sheets
 
I have two sheets with autofilter. The code below works for the one sheet.
How can I list the two sheets in this code? Using Excel 2000Private Sub
Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("Data")
If Not .AutoFilterMode Then
.Range("A1").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="password", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub



ADK

AutoFilter with protected sheets
 
Also, The two sheets have different ranges

sheet1: A6:D6
sheet2: C6:I6

"ADK" wrote in message
...
I have two sheets with autofilter. The code below works for the one sheet.
How can I list the two sheets in this code? Using Excel 2000Private Sub
Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("Data")
If Not .AutoFilterMode Then
.Range("A1").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="password", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub






All times are GMT +1. The time now is 05:36 PM.

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