Welcome to another episode of bending Excel to our collective will.
I have a workbook that currently contains 45 sheets.
The first sheet is just what I use for data validation lists for drop down boxes elsewhere in the workbook.
The second sheet is my raw data sheet, containing up to ~25,000 lines of data
The rest of the sheets are "calls and demand" analysis for various customers. Each sheet contains a single table with up to ~10,000 lines
When I enter a new data set into the raw data sheet, I would like to use a macro to reapply the sort that is on these tables.
From my digging I have found the following:
While I am sure that this has worked for various people, I don't believe it operates in the way that I need it to (read: it runs for 45 minutes and nothing changes).
I believe what this does is simply apply any filters that omit data from the tables, not sort according to the custom sort I have set. I effectively want the same result as if I went to each table in sheets with an index greater than 2 and hit Ctrl+Alt+L
**It is important to note that the number of sheets in the workbook, the names of those sheets, the table names in those sheets, and the number of rows in those tables can all change.**
I have an example file that I can send to anyone interested in helping me figure this out.
Thank you,
I have a workbook that currently contains 45 sheets.
The first sheet is just what I use for data validation lists for drop down boxes elsewhere in the workbook.
The second sheet is my raw data sheet, containing up to ~25,000 lines of data
The rest of the sheets are "calls and demand" analysis for various customers. Each sheet contains a single table with up to ~10,000 lines
When I enter a new data set into the raw data sheet, I would like to use a macro to reapply the sort that is on these tables.
From my digging I have found the following:
VBA Code:
Sub reapplyfilters()
Dim oList As ListObject
Dim cws As Worksheet
For Each cws In ActiveWorkbook.Worksheets
Application.StatusBar = "Refreshing Worksheet " & cws.Index & " " & cws.Name
If cws.Index > 2 Then
For Each oList In ActiveSheet.ListObjects
Application.StatusBar = "Refreshing Worksheet " & cws.Index & " " & cws.Name & " " & oList.Name
DoEvents
oList.AutoFilter.ApplyFilter
Next oList
End If
Next
Application.StatusBar = ""
End Sub
While I am sure that this has worked for various people, I don't believe it operates in the way that I need it to (read: it runs for 45 minutes and nothing changes).
I believe what this does is simply apply any filters that omit data from the tables, not sort according to the custom sort I have set. I effectively want the same result as if I went to each table in sheets with an index greater than 2 and hit Ctrl+Alt+L
**It is important to note that the number of sheets in the workbook, the names of those sheets, the table names in those sheets, and the number of rows in those tables can all change.**
I have an example file that I can send to anyone interested in helping me figure this out.
Thank you,