Reputation: 877
I am working with tables in excel and I want to remove all filter that has been set in any of my 52 columns, remove bold, colors etc(back to normal formatting).
Somehow my code does not do this, any idea where the issue might be?
'Clears filters on the activesheet. Will not clear filters if the sheet is protected.
On Error Resume Next
If ActiveWorkbook.ActiveSheet.FilterMode Or ActiveWorkbook.ActiveSheet.AutoFilterMode Then
ActiveWorkbook.ActiveSheet.ShowAllData
End If
'in case the sheet is protected
ActiveWorkbook.Sheets("List").Cells.EntireColumn.Hidden = False
Upvotes: 2
Views: 21393
Reputation: 877
This solved it:
ActiveWorkbook.Worksheets("List").ListObjects("FilterParts").Sort.SortFields.Clear
ActiveSheet.ShowAllData
However how can I sort this column
Range("FilterParts[[#Headers],[POS NUMBER]]").Select
so that it shows everything except blanks?
Upvotes: 0
Reputation:
If ActiveSheet.AutoFilterMode Then ActiveSheet.Cells.AutoFilter
If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
Upvotes: 1
Reputation: 43585
Can you try with this one instead:
ActiveSheet.AutoFilter.ShowAllData
It may work.
Upvotes: 0