Selecting criteria range in advanced filter; cannot define control shift down on c1

Tardisgx

Board Regular
Joined
May 10, 2018
Messages
81
[FONT=&quot]If recorded control shifting down on C1 VBA creates a defined cell range instead of a dynamic one[/FONT]
[FONT=&quot]Range("C1:C13"), CopyToRange:=Range("D1"), Unique:=False[/FONT]
[FONT=&quot]So I tried to insert VBA I thought would correct the issue because it works normally but got this error[/FONT]
[FONT=&quot]Wrong number of arguments or invalid property assignment[/FONT]
[FONT=&quot]'[/FONT]
[FONT=&quot]Application.CutCopyMode = False[/FONT]
[FONT=&quot]Application.CutCopyMode = False[/FONT]
[FONT=&quot]Application.CutCopyMode = False[/FONT]
[FONT=&quot]Application.CutCopyMode = False[/FONT]
[FONT=&quot]Range("A1:B24112").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _[/FONT]
[FONT=&quot]Range("c1").End(xlDown, CopyToRange:=Range("D1"), Unique:=False)[/FONT]
[FONT=&quot]The range cell vba code works; provides the appropriate output. How can I define that criteria selection in C1 to to be dynamic[/FONT]
[FONT=&quot]In case someone doesn't know what action i'm talking about, Data Tab, sort & filter group, advanced filter brings up this box and the" criteria range" box is the issue.[/FONT]
[FONT=&quot]https://imgur.com/a/lPr4Sos[/FONT]
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Range("A1:B24112").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Range("c1").End(xlDown, CopyToRange:=Range("D1"), Unique:=False)
That is just (trying to) use the bottom value from column C, not the whole column. Parentheses misplaced too. Try
Code:
Range("A1:B24112").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("C1", Range("C1").End(xlDown)), CopyToRange:=Range("D1"), Unique:=False
 
Last edited:
Upvote 0
Thank you :) there was some formatting issue with getting this action to occur on the appropriate sheet when combined with my larger macro (It worked on its own) but ive got it all working now.
 
Upvote 0

Forum statistics

Threads
1,215,943
Messages
6,127,814
Members
449,409
Latest member
katiecolorado

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