I have an inventory workbook that has 7 sheets. All the sheets are protected except for select locked/unlocked cells, and use autofilter so users can only read the info, not edit. I've made a CommandButton on each sheet that resets any/all filters using VBA code in the worksheet. (by "in the worksheet", I mean not in a Module or in the Workbook section, in the VBA editor Project tree I just r-click the sheet containing the button and click View Code....I'm not terribly adept with VBA coding ) The problem is, once I protect the sheets(using protect method in VBA with userinterfaceonly = True) and share it, I get a error "ShowAllData Method of Worksheet class failed - Error - 1004" when I click the "reset all filters" CommandButton. The buttons work until sheet is shared. Below is more detail on the code I am using:
SHEET IS PROTECTED ON OPEN WITH:
I have VBA Trusted in Security and macro sec set to low. The file is set read-only via Windows Security Permissions so users cannot write to the file, however I still get the error if I allow 'Everyone' Full Control so I don't think is a NTFS security issue.
Any and all help is greatly appreciated, this is the final peice to get this sheet deployed. =)
Code:
Private Sub CommandButton1_Click()
If ActiveSheetFilterMode = True Then
ActiveSheet.ShowAllData
ActiveWindow.ScrollRow = 9
Else
MsgBox "<OOPS> |No Filters Currently Set| <OOPS>"
ActiveWindow.ScrollRow = 9
End If
End Sub
SHEET IS PROTECTED ON OPEN WITH:
Code:
Private Sub Workbook_Open()
Worksheets("Sheet1").Protect Password:="mypass", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True, userInterfaceOnly:=True
REPEATED FOR 6 MORE SHEETS VIA Worksheets("Sheet2, etc.")
End Sub
I have VBA Trusted in Security and macro sec set to low. The file is set read-only via Windows Security Permissions so users cannot write to the file, however I still get the error if I allow 'Everyone' Full Control so I don't think is a NTFS security issue.
Any and all help is greatly appreciated, this is the final peice to get this sheet deployed. =)
Last edited by a moderator: