ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter on a Protected Worksheet (https://www.excelbanter.com/excel-programming/289651-filter-protected-worksheet.html)

Brenda[_6_]

Filter on a Protected Worksheet
 
Excel 97 SR-

Trying to allow Auto Filter on a Protected workbook. The following code works fine when I protect the worksheet and workbook. But then when I make it Shared I get a run-time error '1004' Protect method of worksheet type class failed whever I click on a new worksheet.

Private Sub Workbook_SheetActivate(ByVal Sh As Object
With ActiveShee
.EnableAutoFilter = Tru
.Protect DrawingObjects:=True,
contents:=True, Scenarios:=True, UserInterfaceOnly:=Tru
End Wit
End Su

Thank

Brenda

Debra Dalgleish

Filter on a Protected Worksheet
 
You can't change the protection in a shared workbook. There's more
information in the following MSKB article:

XL: Commands and Features Unavailable in Shared Workbook
http://support.microsoft.com/default.aspx?id=130560


Brenda wrote:
Excel 97 SR-2

Trying to allow Auto Filter on a Protected workbook. The following code works fine when I protect the worksheet and workbook. But then when I make it Shared I get a run-time error '1004' Protect method of worksheet type class failed whever I click on a new worksheet.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
With ActiveSheet
.EnableAutoFilter = True
.Protect DrawingObjects:=True, _
contents:=True, Scenarios:=True, UserInterfaceOnly:=True
End With
End Sub


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



All times are GMT +1. The time now is 01:15 PM.

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