Question

How do i filter a dynamic Array, I've been looking around, but i can only find examples of autofilter of arrays. What I have is a dynamic array that changes the contents based on checkboxes. It would then autofilter the dynamic array, but i cannot seem to get the autofilter to work with the dynamic array. With ActiveSheet

With ActiveSheet
    .AutoFilterMode = False
    .UsedRange.AutoFilter
    .UsedRange.AutoFilter field:=1, Criteria1:=userid
    .UsedRange.AutoFilter field:=7, Criterial:=Array_filter
End With

The above filers two columns. i can get the first one working, but not the array one. Please help.

Was it helpful?

Solution

Yes, you can. But you need to use parameter called Criteria1:

.UsedRange.AutoFilter field:=7, Criteria1:= ... '<< with 1 (one) at the end

instead of l (el letter) which you have now.

Additional information after some comment below the answer.

To get all elements from array you need to add additional parameter in discussed line of code:

.UsedRange.AutoFilter field:=7, Criteria1:=Array_filter, Operator:=xlFilterValues

Operator:=xlFilterValues is a key to solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top