gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
My code needs to un-filter a table if it is filtered and then filter it.
this code only works if the data is filtered at the time the code is ran. If there is no filters on then I get a debug 1004 ShowAllData method of Worksheet class failed.
Is there another way to code this? I need to make sure the user did put any other filters on the data before I filter the first column to X
Thanks!
Code:
Sheets("Mtrl Assoc Costs").ShowAllData
Sheets("Mtrl Assoc Costs").ListObjects("MT_All_AssociatedCosts").Range.AutoFilter Field:=1, _
Criteria1:="X"
this code only works if the data is filtered at the time the code is ran. If there is no filters on then I get a debug 1004 ShowAllData method of Worksheet class failed.
Is there another way to code this? I need to make sure the user did put any other filters on the data before I filter the first column to X
Thanks!