I am trying to filter an array in VBA by using the filter function. But every time I try to execute the code, I get an error message
Compile error: Wrong number of arguments or invalid property assign
for some reason. I copied some code from an external source to test it out, but even the simplest example doesn't seem to work. Here's the code:
Private Sub Befehl0_Click()
Dim langs(5) As Variant
langs(0) = "English"
langs(1) = 375
langs(2) = "Spanish"
langs(3) = 442
langs(4) = "Chinese"
langs(5) = 1299.5
output_arr = Filter(langs, 375)
End Sub
Every time I execute the code, the function "Filter" gets highlighted. Does anyone know the answer to this problem?
CodePudding user response:
It works if I try output_arr = VBA.Filter(langs, 375)
as BigBen has stated in the comments!