VBA table filter not working..

BenGee

Board Regular
Joined
Mar 5, 2016
Messages
195
Hi

This part of my code applies a greater than or equal to filter successfully;
Code:
        If ActiveSheet.Range("G3").Value <> "" Then
            .AutoFilter Field:=7, Criteria1:=">=" & ActiveSheet.Range("G3").Value
        End If

But I want it to be equal to, but when I change it, it doesn't filter. I've tried 2 variations;
Code:
        If ActiveSheet.Range("G3").Value <> "" Then
            .AutoFilter Field:=7, Criteria1:="=" & ActiveSheet.Range("G3").Value
        End If

And;
Code:
        If ActiveSheet.Range("G3").Value <> "" Then
            .AutoFilter Field:=7, Criteria1:=ActiveSheet.Range("G3").Value
        End If

The contents of G3 and field 7 are in currency format. If I change to text, the equals filter works but I need to keep as currency + I can't work out why it only works for >=

Thanks in advance for your help
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
The values you are trying to match are formatted as currency - but that doesn't show what the actual value of the cell is. Excel will round to the decimals chosen to view and any value that doesn't match exactly to what you have in G3 will not "=". Please check both what the actual values of G3 and what you are matching to actually do match.
 
Upvote 0
Ok, thanks for your help.

All the value look the same. For example, the value of G3 is "1000" (showing as a currency of £1000), and, in my table there is a matching value of "1000" also showing as a currency of £1000. So still unsure why it's not recognising this when the code is "=" but can recognise these values when it's "<=".

Ive converted all to text and it's working however so will do.

Thanks for your help :)
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

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