Hello EveryBody Please Help me with use Filter in Array vba
i have code
like this
Sub TESTarray_Filter()
a_sn = Range("A2", [A10000].End(3)).Value
a_sp = Filter(Application.Transpose(a_sn), [c2].Value)
With Sheets(2)
.UsedRange.ClearContents
.Cells(1).Resize(UBound(a_sp), 1) = a_sp
End With
End Sub
awwarrr.png
my code sukses if Array (1d) if only one columns
now i want use filter with 2d array
if criteria in C2 and use Filter array vba if meet criteria in col A also in col b copy to sheet2
this is my code
Sub TESTarray_Filter2D()
a_sn = Range("A2", [B10000].End(3)).Value
a_sp = Application.Index(a_sn, Filter(Application.Transpose(a_sn), [c2].Value), Array(1, 2))
With Sheets(2)
.UsedRange.ClearContents
.Cells(1).Resize(UBound(a_sp), 2) = a_sp
End With
End Sub
but my code is error what is wrong with code please help me use filter
Bookmarks