I want to filter a list of industries by using their growth rate as criteria. At the end, I want my sheet just showing industries growing >= 10%.
The data I want to filter is in Tabelle1 Column 10 and is shown as percentage. Furthermore, I have stated my criteria 10% (Which should stay variable) on Tabelle2 Cell B3. However, after exectuing the follwing code it is showing me all industries with a growth rate >= 0%.
Does anyone know why and how I can adjust it to my needs?
Sub AutoFilter()
Dim Bereich As Range
Dim Variable As Long
Set Bereich = Tabelle1.UsedRange
Variable = Tabelle2.Range("B3").Value
Bereich.AutoFilter Field:=10, Criteria1:=">=" & Variable
End Sub
Thank you :)
Your variable needs to be at least float if not double, because e.g. 12%
equals 0.12
.
And .AutoFilter property seems to always expect 'en-US' locale values thus the following code should work:
Sub AutoFilter()
Dim Bereich As Range, Variable As Double
Set Bereich = Tabelle1.UsedRange
Variable = Tabelle2.Range("B3").Value
Bereich.AutoFilter Field:=10, Criteria1:=">=" & Replace(Variable, ",", ".")
End Sub
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments