VBA Advanced Filter Problem for Range criteria

AbdulkareemAlhassni

New Member
Joined
Nov 16, 2018
Messages
41
Hey Gents,

I have the following issue

PHP:
Worksheets("Raw Data for PR Dist").Range("A6:AL1048550").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _
        :=Sheets("Advanced Filter sheet").Range("B10:D174"), Unique:=False

i want the criteria " Range("B10:D174) " to read up to the last value dynamically whenever it changes plus or minus !

such as having " Range("B:10:Up to last value") "

how can i do that ?:eek:
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try this.
Code:
Worksheets("Raw Data for PR Dist").Range("A6:AL1048550").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _
        :=Sheets("Advanced Filter sheet").Range("B10", Sheets("Advanced Filter Sheet").Range("D" & Rows.Count).End(xlUp)), Unique:=False
 
Upvote 0
Try this.
Code:
Worksheets("Raw Data for PR Dist").Range("A6:AL1048550").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _
        :=Sheets("Advanced Filter sheet").Range("B10", Sheets("Advanced Filter Sheet").Range("D" & Rows.Count).End(xlUp)), Unique:=False

what if i want to use it for column B only ?

B1:B last value ?
 
Upvote 0
Try this.
Code:
Worksheets("Raw Data for PR Dist").Range("A6:AL1048550").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange _
        :=Sheets("Advanced Filter sheet").Range("B10", Sheets("Advanced Filter Sheet").Range("D" & Rows.Count).End(xlUp)), Unique:=False

Appreciate it, i changed D to B and it worked.

Thanks alot :)
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,008
Members
449,480
Latest member
yesitisasport

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