VBA Advanced Filter - The FASTEST way to Copy and Filter Data

Excel Macro Mastery · 305K views · 2019 · 18:33

Open on YouTube

Python, Ruby & scripting languagesSoftware practice, open source & careerstutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about Range.AdvancedFilter, criteria ranges and copying filtered data between sheets in VBA.

Recommended by 4 people across 3 different months, 2020 to 2023.

What it is

A tutorial by Paul Kelly of Excel Macro Mastery on using Excel's Advanced Filter from VBA to copy and filter data. It explains why the method is fast and needs little code, walks through the VBA, and shows how to trigger the filter from a worksheet event.

What people said

Recommends VBasic2008 · 2020-06 · Stack Overflow · on “Excel Advanced Filter not doing anything”

Why don't you use `Sheet1.Range("AZ2").CurrentRegion` and `Sheet1.Range("AD6").CurrentRegion`. Keep in mind that the first row has to contain the headers. Also, if you have not already, watch this video [this video] .

Recommends Gokhan Aycan · 2020-12 · Stack Overflow · on “Generating a filter loop based off of two criteria in another sheet?”

I wanted to add a comment but not enough reputation yet. One question I have is: Are you filtering on one phrase among 200-400 or can it be multiple? I can't be sure, however an Advanced Filter might help you in this case. It is not possible for me to go into all the details. There is a very good tutorial on Youtube about this (where I learned myself): VBA Advanced Filter - The FASTEST way to Copy and Filter Data [this video] You can also use "Worksheet_Change" event to fill in the filter. Couple it with: If Not Application.Intersect(Target,rngRange) is Nothing Then ' Your code here ' Where rngRange is a Range object that you want the change event to catch End If Another note is, you can use (con

Recommends GWD · 2020-12 · Stack Overflow · on “Copy cells from one worksheet to another based on multiple column criteria”

I can recommend this excellent article [LINK] about copying data with VBA by Paul Kelly (ExcelMacroMastery). You will find detailed descriptions of how to use `Range.AdvancedFilter` there. If you prefer following a video, he also has an equally great video [this video] on the topic.

Recommends DjC · 2023-11 · Stack Overflow · on “Macro (advancedfilter) is also triggered when inserting rows”

@Simon Further to my answer below, I highly recommend checking out VBA Advanced Filter - The FASTEST way to Copy and Filter Data [this video] on Excel Macro Mastery's YouTube channel.

Cites VBasic2008 · 2020-06 · Stack Overflow · on “Excel Advanced Filter not doing anything”

Advanced Filter Example This solution is based on Paul Kelly [LINK] 's [this video] . [LINK] [LINK] [LINK] Check if the headers are the same in all three ranges. To use the following code, just replace my values A3,A11,A16 with your values A1,AZ2,AD6 . The Code Option Explicit Sub FilterMe() Const Proc As String = "FilterMe" On Error GoTo cleanError Const src As String = "A3" Const cri As String = "A11" Const cop As String = "A16" ' Define ranges. Dim Source As Range, Criteria As Range, CopyTo As Range With Sheet1 Set Source = .Range(src).CurrentRegion Set Criteria = .Range(cri).CurrentRegion Set CopyTo = .Range(cop).CurrentRegion End With ' Apply filter. Application.DisplayAlerts = False Source.

Cites iѕєρєня · 2021-09 · Stack Overflow · on “EXCEL VBA: How to filter on same column header across multiple worksheets”

if you add two simple cells to one of your sheets containing the header text and the value you want to filter you can use the below code to achieve the intended result. for example my header named "Date" so in my first sheet I wrote "Date" in A3 and the date I want to filter into A4 . just keep in mind that since we are searching for the "Date" header in first row either we should put our so called Criteria Range header in another row or since our search ends with first occurrence we can add the new header to one of the columns after our original Date column . Note: The Criteria Range table headers must be exactly like the target selection headers for this to work. so here I have one column