A quick way to filter

itsgrady

Board Regular
Joined
Sep 11, 2022
Messages
132
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
I have a large table of 25,000+ rows. This data is updated throughout the day. I have to “Filter” the document each day by one of the columns “Inb Pro”. For the most part, the filtering is the same each day, but I do have to add new filter each week.

I have to choose 25 to 30 filters each day and there is room for errors. Is there way can automate this task through VBA or some other method.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
YES. What I have done on a current WB I manage is to create a pulldown that allows me to choose which filter I want to run. The data validation uses the table below.

Time-Phase and Submit Checker_CWF.xlsm
BCD
1List of Checks
2NumDescriptionMacro
30.10.1 Showing most recent time phased at topRecent
40.20.2 Default ViewDefaults
51.01.0 Did not submit after last time phaseCheck_1
62.02.0 Had actual and/or forecast in current month, needs attentionCheck_2
73.03.0 Check blanks, verify no missed TimePhase/SubmitCheck_3
84.04.0 Compare Cur Month Forecast to Cur Month ACWPCheck_4
95.05.0 Check for Undistributed EACCheck_5
106.06.0 Check for Costs Hitting After Last Forecast SubmittalCheck_6
11
12
13
SETUP


These macros when I choose one of the items
VBA Code:
Private Sub RunCheck_btn_Click()
  
  Dim CheckItm As String
  Dim CheckList As Range
  Dim CheckSub As String
  Dim Itm As Long
  
  
  CheckItm = Range("Check_Comment").Value
  Set CheckList = SETUP.Range("CheckList")
  Itm = Application.WorksheetFunction.Match(CheckItm, CheckList, 1)
  CheckSub = CheckList.Resize(1, 1).Offset(Itm - 1, 1)
  
  Application.Run CheckSub
  
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
  
  If Not Intersect(Target, Range("Check_Comment")) Is Nothing Then
    RunCheck_btn_Click
    Range("Check_Comment").Select
  End If
  
End Sub

This is one of the Filter Subs that get called
VBA Code:
'1.0 Did not submit after last time phase
Sub Check_1()
  
  Dim Fld1 As Long
  Dim Fld2 As Long
  
  Fld1 = GetFieldNum(Range("CompTbl[#Headers]"), "Time Phase vs Submittal")
  
  Application.ScreenUpdating = False
  
  Range("$A$4").Select
  Clear_Filter
  Comp.ListObjects("CompTbl").Sort.SortFields.Clear
  Comp.ListObjects("CompTbl").Sort.SortFields.Add2 Key:=Range("CompTbl[[#All],[Time Phase vs Submittal]]"), SortOn:= _
        xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
    With Comp.ListObjects("CompTbl").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Comp.ListObjects("CompTbl").Range.AutoFilter Field:=Fld1, Criteria1:="Bad"

  'ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
  'Range("Check_Comment").Value = "1.0 Did not submit after last time phase"
  CursorHome
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for the reply. Looks very interesting. How easy is it to add a new criteria for the end user?
 
Upvote 0
It is currently setup to run the same filters every time. An end user would not like to edit this.

For future iterations it would be cool to have a table allowing multiple criteria choices for each selection made.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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