Incompatible decimal separator for VBA autofilter

dotsent

Board Regular
Joined
Feb 28, 2016
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Hi!

Ran into a silly issue, but not sure how to get past it. I have value in cell "N10" with 2 decimal places (from SUBTOTAL formula, but manual entry makes no difference). I also use "European" numeric system with comma as the decimal separator (instead of dots).

This decimal separator seems to create major issues when using cell value as input parameter for VBA autofilter. On closer inspection, my cell value "161,06" has been converted into "161.06" in autofilter, ending up with no results. Both search parameter value and table values both obviously share commas as decimal separators.

I have tried formatting both search and table range into General and Number, but to no avail. Also custom formatting doesn't provide the option to change the decimal separator in my single table (although that's not a preferred workaround). Seems relatively easy, however I'm clueless on how to proceed.
Have been testing with a code snippet like this one:

Code:
Sub TEST()

    With ActiveSheet.ListObjects("Table1").Range
    .AutoFilter Field:=8, Criteria1:=Range("N10")

    End With

End Sub


One option would be to add a helper column in my table where to rebuild my number from , to . separator and run the filter on this column, however hoping there's a more humane way to do it.
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

dotsent

Board Regular
Joined
Feb 28, 2016
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Unfortunately .Value2 parameter didn't work for me either. However got the hint from the link and .Text parameter keeps my decimal separator intact. Thanks!

Using this is not recommended in the link, but I don't see a good alternative.
 
Last edited:

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,977
Office Version
  1. 365
Platform
  1. Windows
glad it helped
thanks for the feedback
(y)
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,127,934
Messages
5,627,697
Members
416,266
Latest member
stevenvanroeden

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