Filter tables in the workbook

Celticfc

Board Regular
Joined
Feb 28, 2016
Messages
153
Hi all,

My tables retrieve entries from the database through a dropdown list so they can have 1 to 500 entries therefore auto filter to remove blanks is inevitable.

I have tables across many sheets however they don't start from the same row or column.

In order to filter out blanks, I had to record a macro and assign it to a button but it takes about 30 seconds to process.

Is there a way to cut the processing time? Perhaps we don't have to choose each table/sheet individually but as a whole?

My code is below, thank you in advance.

Sub FilterOutBlanks()
'
' FilterOutBlanks Macro
'
'
Code:
    Sheets("Talent OutFlow").Select
    ActiveSheet.ListObjects("TalentOutflow").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    Sheets("One-Pager Profile").Select
    ActiveSheet.ListObjects("Table18").Range.AutoFilter Field:=1, Criteria1:= _
        "<>"
    Sheets("Internal Promotions").Select
    ActiveSheet.ListObjects("InternalPromotions").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    Sheets("External Hires").Select
    ActiveSheet.ListObjects("ExternalHires").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    Sheets("Talent Inflow").Select
    ActiveSheet.ListObjects("TalentInflow").Range.AutoFilter Field:=1, Criteria1 _
        :="<>"
    Sheets("Exceptions-Overheads").Select
    ActiveSheet.ListObjects("StatusExceptions").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    Sheets("Talent Calibrations").Select
    ActiveSheet.ListObjects("Calibrations").Range.AutoFilter Field:=1, Criteria1 _
        :="<>"
    Sheets("Current CDN-U").Select
    ActiveSheet.ListObjects("CurrentCDNorU").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    
    Sheets("Exits").Select
    ActiveSheet.ListObjects("LeaversTable").Range.AutoFilter Field:=1, Criteria1 _
        :="<>"
    Sheets("Demotions").Select
    ActiveSheet.ListObjects("DemotionsORexits").Range.AutoFilter Field:=1, _
        Criteria1:="<>"
    Sheets("Current Vacancies").Select
    ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=1, Criteria1:= _
        "<>"
    Sheets("Language").Select
    ActiveSheet.ListObjects("Languages").Range.AutoFilter Field:=1, Criteria1:= _
        "<>"
    Sheets("Mobility").Select
    ActiveSheet.ListObjects("Mobility").Range.AutoFilter Field:=1, Criteria1:= _
        "<>"
End Sub
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
There is no need for the Select, which eats up time, try:

Code:
Sub ClearSpaces()
    Sheets("Talent OutFlow").ListObjects("TalentOutflow").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("One-Pager Profile").ListObjects("Table18").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Internal Promotions").ListObjects("InternalPromotions").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("External Hires").ListObjects("ExternalHires").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Talent Inflow").ListObjects("TalentInflow").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Exceptions-Overheads").ListObjects("StatusExceptions").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Talent Calibrations").ListObjects("Calibrations").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Current CDN-U").ListObjects("CurrentCDNorU").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Exits").ListObjects("LeaversTable").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Demotions").ListObjects("DemotionsORexits").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Current Vacancies").ListObjects("Table4").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Language").ListObjects("Languages").Range.AutoFilter Field:=1, Criteria1:="<>"
    Sheets("Mobility").ListObjects("Mobility").Range.AutoFilter Field:=1, Criteria1:="<>"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,826
Messages
6,127,116
Members
449,359
Latest member
michael2

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