Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter List In Place

Status
Not open for further replies.

EliseFreedman

Programmer
Dec 6, 2002
470
GB
Hi There

I have a rather large spreadsheet

I am trying to create a macro to filter the named range in place using specified criteria. Those Criteria are saved further down in my spreadsheet in the format
Age Age
>=40 <=55

I am using the code
Code:
Range("Database").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("A20003:B20004"), Unique:=False

When I try to run the code, it finds 0 of 39 records even though I know there is matching data and then i get the message
Code:
Could Not be completed using range specified

I have done a similar task a while back which worked ok. I cant see any difference between the code i used then and the code im using now. Does anyone have any suggestions
 
How many rows are included in "Database" ? >20003 ? Please check Range Name definition to check this

When you did this before, was the criteria in a seperate column from the data ?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hi Geoff.

There are 39 records(rows A2..A40) included within 'Database'. Only a small number of these fullfil the specified criteria. The criteria is in columns A and B but much further down the spreadsheet. This is the same as when i did it before when it worked fine
 
Have you created this range name or are you using teh default name created when you put a filter in place ? If you have created it, you may be better off renaming therange to something like dBase as "database" is probably a reserved name

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top