Advanced Filter VBA

lwarren30

New Member
Joined
Jul 3, 2018
Messages
35
Hello,
I'm using an advanced filter vba to search for data from within a large data set onto another sheet. I've worked this before but this time it is not working.

Code:
Range("Sheet_K_2D_FinancialInput").AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet15.Range("BV4:BZ5"), CopyToRange:=Sheet15.Range("AV5:BS5"), Unique:=False

I can provide screenshots if you are familiar with this code.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try (untested):

Code:
With Range("Sheet_K_2D_FinancialInput")
    .AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet15.Range("BV4:BZ5"), Unique:=False
    .SpecialCells(xlCellTypeVisible).Copy Sheet15.Range("AV5")
End With
 
Last edited:
Upvote 0
The advanced filter CopyTo range must be relative, the activesheet. The other two inputs can be on another sheet.
 
Upvote 0
Maybe there's a problem with the named range?
Let's try just filtering in place (just to test the named range), is it work?
Code:
Range("Sheet_K_2D_FinancialInput").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet15.Range("BV4:BZ5"), Unique:=False
 
Upvote 0
Or a simpler test:

Code:
Debug.Print Range("Sheet_K_2D_FinancialInput").Address
 
Upvote 0
Code:
Sheet15.Activate
Range("Sheet_K_2D_FinancialInput").AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Range("BV4:BZ5"), CopyToRange:=Range("AV5:BS5"), Unique:=False
 
Upvote 0
It filters in place with:

Range("Sheet_K_2D_FinancialInput").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet12.Range("AA2:AE3"), Unique:=True

Maybe there's a problem with the named range?
Let's try just filtering in place (just to test the named range), is it work?
Code:
Range("Sheet_K_2D_FinancialInput").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet15.Range("BV4:BZ5"), Unique:=False
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

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