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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
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,325
Messages
6,124,254
Members
449,149
Latest member
mwdbActuary

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