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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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