I am trying to filter table data into an array with criteria from a separate column within that table.
I can achieve this on a worksheet with a simple formula which creates a spilled array.
=FILTER(tblMain[Name],tblMain[At Work]=1)
I get errors with this code:
Sub myArraySub()
Dim myTable As ListObject
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim myArray3 As Variant
'Set path for Table variable
Set myTable = ActiveWorkbook.Worksheets("Main").ListObjects("tblMain")
'Create Array
myArray1 = Application.Transpose(myTable.ListColumns("Name").DataBodyRange.Value)
myArray2 = Application.Transpose(myTable.ListColumns("At Work").DataBodyRange.Value)
myArray3 = Application.Filter(myArray1, myArray2 = 1)
End Sub
I will ultimately use the array to test other tables if the Name appears in the array.