I've got a list of values, and am trying to apply an auto filter to it. All this set in a while loop. While the filter value seems right, I have to enter Excel click on the filter menu and click okay again.
Dim zaehlerHeights As Double
zaehlerHeights = 0.4
While zaehlerHeights <= 25
Sheets("Rohdaten WG22").Select
Columns("S:S").Select
Range("Tabelle13[[#Headers],[HOEHE_VON]]").Activate
ActiveSheet.ListObjects("Tabelle13").Range.AutoFilter Field:=19, Criteria1 _
:="<" & zaehlerHeights, Operator:=xlAnd
Columns("T:T").Select
Range("Tabelle13[[#Headers],[HOEHE_BIS]]").Activate
ActiveSheet.ListObjects("Tabelle13").Range.AutoFilter Field:=20, Criteria1 _
:=">" & zaehlerHeights, Operator:=xlAnd
ActiveSheet.AutoFilter.ApplyFilter
Not sure why this is so. Any ideas?
Edit: So, thanks to Mike and Peh, we narrowed down the problem. It seems that the decimal separator is the problem. I use the German version of Excel, while Mike, for whom his solution works, probably uses the English/American version. The separator for me is the comma, while for Mike it is the dot. VBA, though translating my dot to a comma, won't apply the filter properly. We tried replace() for the variable, but that doesn't work either. If I go through enough loops to reach a integer value (e.g. 1.0) the filters work just fine.
So, still no solution, but a better picture of the error. I assume, that if I would using the English version of Excel, the code would work just fine. For me this is more of a bug.
Thanks in advance Jerome