My worksheet is password protected. When protected, I want to enable AutoFilter for the users. I can do this manually by choosing these Protect Sheet options:
- Select locked cells
- Select unlocked cells
- Use AutoFilter
After protecting the worksheet, the AutoFilter feature works as desired. But when my VBA code executes it does not work. The AutoFilter dropdown arrows are present but the dropdown menu will not appear.
Private Sub Worksheet_Activate()
Const pWord = "mypw"
ActiveSheet.Unprotect Password:=pWord
ActiveSheet.ListObjects(1).ShowAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
AllowFiltering:=True
ActiveSheet.Protect Password:=pWord
End Sub
Please help me modify my code so that it enables AutoFilter after the worksheet is protected.
Thanks!
Bookmarks