Filters Not filtering

tantric_lover

New Member
Joined
Jul 5, 2006
Messages
10
Hi,

Has anyone ever come across the following problem...and of course if they have a solution that would be fab.

I am extracting data via ODBC to an Excel sheet. Using VB Code I am doing an Advanced Filter on one of the items which is a Project Code (4 numerals). Now I have a misc Proj code of 9999 which I want to filter out which I have set up in code on the Worksheet_Change procedure.

Here is the code for that section:
Worksheets("Net Spend").Range("Database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Net Spend").Range("S2:T3"), _
CopyToRange:=Range("A2:Q2"), Unique:=False

S2 to T3 are :
AFE Year- Project
2005 - <>9999

Now the Project Code of 9999 is not filtered out. But if I go to the cell with 9999 in it, press F2 then Return and then reapply the filter it works. The Year part works fine btw.

I don't understand why it won't filter out 9999 until I go on each cell and hit F2 - Return.
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,871
Hi

The number must have been imported as text. That's why it's not recognised. When you hit F2 and return, excel automatically converts it to number.

You may have to convert all numbers.

Select a column, Data>Text to columns, click Finish.

Hope this helps
PGC
 

tantric_lover

New Member
Joined
Jul 5, 2006
Messages
10
Hi

The number must have been imported as text. That's why it's not recognised. When you hit F2 and return, excel automatically converts it to number.

You may have to convert all numbers.

Select a column, Data>Text to columns, click Finish.

Hope this helps
PGC

That worked fine. I done it on the ODBC sheet. So I jsut need to remember to do text To Columns - Finish every time I refresh the data. Thanks for that.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,407
Messages
5,547,766
Members
410,811
Latest member
adustin42
Top