I have a dynamic table, and I want to filter a number of criteria depending on if the requirements are met or not. I have tried this:
Sheets("TABLE").Select
With Worksheets("TABLE").Range("A1")
'ANSI
.AutoFilter field:=5, _
Criteria1:=Array( _
If Worksheets(Build).Range(B7) = "True" Then "1 000", _
If Worksheets(Build).Range(C7) = "True" Then "2 000", _
If Worksheets(Build).Range(D7) = "True" Then "3 000", _
), _
Operator:=xlFilterValues
It seems that I cannot use an if statement to define an array? Or is my syntax wrong? Any other way I could do this? Using Criteria1:="", Operator:=xlAnd, Criteria2:="", limit me to only two criteria but I have around 12 to filters.
Many thanks!
Aucun commentaire:
Enregistrer un commentaire