willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 931
- Office Version
- 365
- Platform
- Windows
Hello,
I was wanting to know what the difference was between these 2 codes to clear filters? I was given these in the past and was wondering if there was a difference?
Sometimes I want to clear a filter on a table and other times just a standard filter.
Thank you for your help ?
I was wanting to know what the difference was between these 2 codes to clear filters? I was given these in the past and was wondering if there was a difference?
Sometimes I want to clear a filter on a table and other times just a standard filter.
Thank you for your help ?
VBA Code:
'Code #1'
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
'Code #2'
Dim lo As ListObject
For Each lo In ActiveSheet.ListObjects
lo.AutoFilter.ShowAllData
Next lo