error - Worksheet class failed

Asrampd

Board Regular
Joined
Feb 26, 2012
Messages
247
I need a macro to clear the filtering (possibly on several columns) and got this Macro off of the interweb - and when it runs it clears the filtering and leaves the filter arrows in place, but then ends with an error (having done what was required nicely). it says ...Run-time error 1004 ShowAllData method of worksheet class failed, WHAT IS WRONG ?

Sub AutoFilter_Remove()
'This macro removes any filtering in order to display all of the data but it does not remove the filter arrows
ActiveSheet.ShowAllData
End Sub

Ta.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I expect that you're trying to run the macro a second time, maybe inadvertently or in a loop, when the filters have already been cleared. It's telling you that there's nothing to do now; it's already done.

If you put in a new line above that action:
On Error Resume Next

then when that line results in the error condition you're now seeing, it will be ignored and control passed to the next line in your code.
 
Upvote 0

Forum statistics

Threads
1,203,172
Messages
6,053,888
Members
444,692
Latest member
Queendom

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