Filter on a Protected Worksheet

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top