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.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,835
Messages
5,855,907
Members
431,772
Latest member
dannyboi1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top