I'm attempting to take a list of names and filter another list based on whether these names appear. To do so, I want to create an array of the names and then take this array to apply an autofilter to the other sheet from a specific column. Here's the code I currently have:
Dim AdvisorEINs As Variant
AdvisorEINs = Worksheets("Names to Filter").Range("A1:A36").Value
Worksheets("All Advisors").Range("$A$1:$DZ$2216").AutoFilter Field:=15, Criteria1:=AdvisorEINs.Value, Operator:=xlFilterValues
Currently this is returning Run-time error '424': Object required when attempting to run and debugging is highlighting the filtering line. I've added in a Debug.Print on the AdvisorEINs variable, which outputs the same error message and suggests to me that this is due to variable not picking up data correctly. I'm not certain how to have the array pick up the data any other way - is someone able to advise on this?
AdvisorEINsis an array of values.Criteria1:=AdvisorEINs.Valuetreats it like a range. So there is a datatype error in this assignment. It should beCriteria1:=AdvisorEINs. But beyond that, shouldn't Criteria1 be a single value? Is it possible to assign an array to it?Operator:=xlFilterValues, as OP's doing