Reapplying multi column sorting for tables on multiple worksheets

jonstr101

New Member
Joined
May 13, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
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:

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,
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,215,226
Messages
6,123,734
Members
449,116
Latest member
alexlomt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top