Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
using advanced filter in VBA with a dynamic range
I recorded the following macro, which applies the Advanced Filter to a range
of data. This range of data changes from month to month, in terms of the number of rows of data. The criteria range and the number of columns do not change. How can I modify it to automatically adjust the filter range? Here's the code: Sub AdvFilterTest() ' ' AdvFilterTest Macro ' Macro recorded 10/2/2006 by df78700 ' ' Range("A5:S42207").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _ Range("U1:U5"), CopyToRange:=Range("V1"), Unique:=False End Sub Basically, the thing that would change from month to month is the cell in column S of the first range given. Hope I've made this clear. Thanks, Dave -- Brevity is the soul of wit. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
using advanced filter in VBA with a dynamic range
Try:
Range("A5:S" & Range("S" & Rows.Count).End(xlUp)) -- Charles Chickering "A good example is twice the value of good advice." "Dave F" wrote: I recorded the following macro, which applies the Advanced Filter to a range of data. This range of data changes from month to month, in terms of the number of rows of data. The criteria range and the number of columns do not change. How can I modify it to automatically adjust the filter range? Here's the code: Sub AdvFilterTest() ' ' AdvFilterTest Macro ' Macro recorded 10/2/2006 by df78700 ' ' Range("A5:S42207").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _ Range("U1:U5"), CopyToRange:=Range("V1"), Unique:=False End Sub Basically, the thing that would change from month to month is the cell in column S of the first range given. Hope I've made this clear. Thanks, Dave -- Brevity is the soul of wit. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Advanced Filter using a range name as the criteria | Excel Worksheet Functions | |||
Advanced filter a dynamic date range | Excel Worksheet Functions | |||
Advanced Filter to Dynamic Range | Excel Programming | |||
advanced filter a range | Excel Worksheet Functions | |||
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du | Excel Worksheet Functions |