Excel VBA AutoFilter Percentages

HPM

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 :)

TheChatty

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Set AutoFilter in Excel with VBA

From Dev

Excel VBA AutoFilter Codes

From Dev

Excel VBA autofilter all but three

From Dev

Autofilter on Mutliple Columns Excel VBA

From Dev

Excel VBA AutoFilter adds empty rows

From Dev

excel vba - autofilter from selected range

From Dev

VBA Excel autofiltermode = false not turning off autofilter

From Dev

Excel VBA syntax for numeric wildcard in AutoFilter Criteria?

From Dev

Excel VBA copying rows using autofilter

From Dev

Excel VBA add Autofilter if it doesn't exist

From Dev

VBA Autofilter Set by Date in Excel - not showing any data

From Dev

Delete Hidden/Invisible Rows after Autofilter Excel VBA

From Dev

Excel VBA Autofilter issues with multiple inputs per column

From Dev

VBA Excel autofilter for any date before the current month

From Dev

How to transfer criteria from string array to autofilter. VBA Excel

From Dev

excel vba autofilter range and delete all rows with 0 in col D

From Dev

excel VBA - return Criteria1 Array from an Autofilter

From Dev

AutoFilter for a value which has a newline character in between (Excel/VBA)

From Dev

VBA Autofilter Set by Date in Excel - not showing any data

From Dev

Excel Autofilter doesn't work on column with date and time with VBA code

From Dev

How do I loop through an Autofilter using VBA in excel?

From Dev

Excel VBA Runtime Error 1004 ActiveSheet.ListObject.Range.Autofilter

From Dev

excel vba Assign cell value to variable from Autofilter result

From Dev

excel VBA - return Criteria1 Array from an Autofilter

From Dev

VBA Autofilter with variable range

From Dev

VBA Autofilter with variable range

From Dev

Autofilter for multiple fields in VBA

From Dev

Detect autofilter on Excel Tables

From Dev

Excel autofilter errors

Related Related

  1. 1

    Set AutoFilter in Excel with VBA

  2. 2

    Excel VBA AutoFilter Codes

  3. 3

    Excel VBA autofilter all but three

  4. 4

    Autofilter on Mutliple Columns Excel VBA

  5. 5

    Excel VBA AutoFilter adds empty rows

  6. 6

    excel vba - autofilter from selected range

  7. 7

    VBA Excel autofiltermode = false not turning off autofilter

  8. 8

    Excel VBA syntax for numeric wildcard in AutoFilter Criteria?

  9. 9

    Excel VBA copying rows using autofilter

  10. 10

    Excel VBA add Autofilter if it doesn't exist

  11. 11

    VBA Autofilter Set by Date in Excel - not showing any data

  12. 12

    Delete Hidden/Invisible Rows after Autofilter Excel VBA

  13. 13

    Excel VBA Autofilter issues with multiple inputs per column

  14. 14

    VBA Excel autofilter for any date before the current month

  15. 15

    How to transfer criteria from string array to autofilter. VBA Excel

  16. 16

    excel vba autofilter range and delete all rows with 0 in col D

  17. 17

    excel VBA - return Criteria1 Array from an Autofilter

  18. 18

    AutoFilter for a value which has a newline character in between (Excel/VBA)

  19. 19

    VBA Autofilter Set by Date in Excel - not showing any data

  20. 20

    Excel Autofilter doesn't work on column with date and time with VBA code

  21. 21

    How do I loop through an Autofilter using VBA in excel?

  22. 22

    Excel VBA Runtime Error 1004 ActiveSheet.ListObject.Range.Autofilter

  23. 23

    excel vba Assign cell value to variable from Autofilter result

  24. 24

    excel VBA - return Criteria1 Array from an Autofilter

  25. 25

    VBA Autofilter with variable range

  26. 26

    VBA Autofilter with variable range

  27. 27

    Autofilter for multiple fields in VBA

  28. 28

    Detect autofilter on Excel Tables

  29. 29

    Excel autofilter errors

HotTag

Archive