Autofilter table with formatted currency

winsbury

New Member
Joined
Feb 10, 2022
Messages
12
Office Version
  1. 2007
Platform
  1. Windows
This sounds super easy, but after 3 days of trying everything I can think of its time to come clean and admit I need help....

In Table 1 I have a column of transactions formatted as
_(£* #,##0.00_);_(£* (#,##0.00);_(£* "-"??_);_(@_)

I wish to filter on an exact value, for example £500.00

When doing this manually in the table header by ticking the box next to the value £500.00 the filter works just fine and returns only the records where the value is exactly £500.00

However, recording the exact same actions into a macro, returns code below which always returns zero records:
VBA Code:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:="£500.00"

How do I get it to return records with the stated value ?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
The cells contain numbers, it's only the formatting which is currency. Surprisingly >,<,<>,>=,<= all work as expected so it is possible to construct a nasty looking line which filters on an exact value but there has to be a better way to do a simple equals (=) than this monstrosity, also since in the actual code the criteria is held in variable from user input form textbox this method prevents the user from using >,< etc in their criteria.
VBA Code:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:="500"     'returns zero records
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:=">=500", Criteria2:="<=500"     'correctly returns records with an exact value of £500.00
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,334
Members
449,077
Latest member
Jocksteriom

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
Back
Top