Hello!
I'm attempting to get a Query table to filter with an array made from the values in column A of another sheet.
I'm having the worst of luck...I was pretty sure this would work but for some reason I'm getting a "type mismatch error '13'" attached to the line that says "sArray(i) = var1(i, 1)"
My code:
Sub SON()
Dim srange As Range
Set srange = Sheet13.Range("A2:A60")
Dim var1 As Variant
Dim sArray() As String
Dim i As Long
var1 = srange.Value
ReDim sArray(1 To UBound(var1))
For i = 1 To (UBound(var1))
sArray(i) = var1(i, 1) ' here's where the error is...
Next
Sheet12.ListObjects("Table_Query_from_ELHR").Range.AutoFilter Field:=5, _
Criteria1:=sArray, Operator:=xlFilterValues
End Sub
Could anyone tell me what I'm doing wrong?
Bookmarks