V
Valeria
Dear experts,
I have a protected sheet with autofiltering. I would like to reset the
autofilter every time a new user opens the workbook. I have a code (see
below) that works well for a user at the time, but when another user tries to
open the workbook on the server (as read-only or notify), he/she gets an
error: "method 'Worksheets' of object '_Workbook' failed"
Could you please help me?
Many thanks!
Best regards,
Valeria
Sub auto_open()
Dim i As Integer
Worksheets("Sheet1").Activate
ActiveSheet.Unprotect Password:="my_password"
ThisWorkbook.Worksheets("Sheet1").AutoFilterMode = False
ThisWorkbook.Worksheets("Sheet1").Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Protect Password:="my_password", DrawingObjects:=True,
Contents:=True, Scenarios:=True, AllowFormattingCells:=True,
AllowFormattingColumns:=False, AllowFormattingRows:=True, AllowSorting:=True,
AllowFiltering:=True
End Sub
I have a protected sheet with autofiltering. I would like to reset the
autofilter every time a new user opens the workbook. I have a code (see
below) that works well for a user at the time, but when another user tries to
open the workbook on the server (as read-only or notify), he/she gets an
error: "method 'Worksheets' of object '_Workbook' failed"
Could you please help me?
Many thanks!
Best regards,
Valeria
Sub auto_open()
Dim i As Integer
Worksheets("Sheet1").Activate
ActiveSheet.Unprotect Password:="my_password"
ThisWorkbook.Worksheets("Sheet1").AutoFilterMode = False
ThisWorkbook.Worksheets("Sheet1").Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Protect Password:="my_password", DrawingObjects:=True,
Contents:=True, Scenarios:=True, AllowFormattingCells:=True,
AllowFormattingColumns:=False, AllowFormattingRows:=True, AllowSorting:=True,
AllowFiltering:=True
End Sub