using advanced filter in VBA with a dynamic range

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top