ShowAllData Error in Shared Workbook

Boa_2K9

New Member
Joined
Apr 7, 2009
Messages
2
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:

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:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,627
Messages
6,173,424
Members
452,515
Latest member
Alicedonald9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top