M McAllister
New Member
- Joined
- Apr 16, 2013
- Messages
- 15
Windows 7, Excel 2010
I have workbook with 6 data tables fed by data connections. When I close the workbook, I want to clear all the filters in each of the tables before saving and closing the workbook.
I have a lazy macro that loops through the each table and sheet, but doesn't clear the table filters.
Any help is appreciated.
Thanks,
Mathew
I have workbook with 6 data tables fed by data connections. When I close the workbook, I want to clear all the filters in each of the tables before saving and closing the workbook.
I have a lazy macro that loops through the each table and sheet, but doesn't clear the table filters.
Code:
Dim ws As Worksheet
Dim lo As ListObject
For Each ws In ActiveWorkbook.Worksheets
For Each lo In ws.ListObjects
ws.Activate
With ActiveSheet
If .AutoFilterMode Then
If .FilterMode Then
.ShowAllData
End If
End If
End With
Next
Next
Any help is appreciated.
Thanks,
Mathew