How to have Dynamic Range for Advance Excel Filters in VBA

abdulads

Board Regular
Joined
Dec 22, 2013
Messages
81
Hi All,

I have this recorded Macro wanted to change there range of the table to dynamic how can i do it.

Sheets("Cats_da").Range("A3:P164704").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("D Day").Range("D1:S3"), CopyToRange:=Range("A1" _
), Unique:=False
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You mean something like this ??
VBA Code:
Dim lr As Long
lr = Sheets("Cats_da").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Cats_da").Range("A3:P" & lr).AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("D Day").Range("D1:S3"), CopyToRange:=Range("A1" _
), Unique:=False
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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