macro for auto filter

G

Guest

I have a macro for a form button on a sheet. It runs an auto filter, and works fine until i protect the sheet. Then it will not work. Will auto filter not work on a protected sheet?... I have changed the security settings to allow auto filter in the protection tab.
 
J

John Wilson

Bris,

You need to protect the sheet via code and enable AutoFilter.
The enable Autofilter will not stay when the workbook is closed
and reopened so you'll have to insure that the code runs whenever
the workbook opens.

Here's some sample code (modify to suit):

Sub Auto_Open()
With Worksheets("Sheet1")
..Protect Password:="pass", userinterfaceonly:=True
..EnableAutoFilter = True
End With

End Sub

John

Bris said:
I have a macro for a form button on a sheet. It runs an auto filter, and
works fine until i protect the sheet. Then it will not work. Will auto
filter not work on a protected sheet?... I have changed the security
settings to allow auto filter in the protection tab.
 

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