VBA Advanced Filter Criteria (How to insert UsedRange in Range Sta

G

Guest

Using XL 2003 & 97

My Code is:

Sheets("Filtered Data").Range("A1:Q5217").AdvancedFilter
Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Criteria Sheet").Range(BEM_CUY), _
CopyToRange:=Range( "A1"), Unique:=False

How do I get the Range statement to sense the used range?

Otherwise Q5127 is a constant.

TIA

Dennis
 
B

Bob Phillips

How about this (not tried I am afraid)

Set oRng = Sheets("Filtered Data").UsedRange
oRng.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Criteria Sheet").Range(BEM_CUY), _
CopyToRange:=Range( "A1"), Unique:=False
 

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