View Full Version : Protection and command buttons error


USMCFROSTY
01-07-2011, 06:54 AM
I have a cmd button to clear the filters but when i protect the sheet i get an error.

Run-time error 1004
ShowAllData method of worksheet class failed

When i debug i get the highlight below

Private Sub CommandButton1_Click()
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
End Sub

Looking for some help understanding this please.

the_net_2.0
01-07-2011, 12:40 PM
is ''showalldata'' even valid when sheet protection is enabled? if actions aren't allowed under certain conditions, such as a sheet protection, vba will sometimes throw a "failed" error, "you can't do this" type of error.

that would be my first guess, personally.

USMCFROSTY
01-12-2011, 07:38 AM
It works fine with no protection but only when i protect the sheet i get the error.
How can i usa a clear all filters with protecting the sheet? Is there another way?