I've updated my code which now works as intended, however I would like set filterList1 and filterList2 equal to cell C5 and C6 respectively on my "Assumptions" worksheet. How can I do this?
I tried setting filterList1 = Worksheets("Assumptions").Cells(5, "C").Value and filterList2 = Worksheets("Assumptions").Cells(6, "C").Value but doing so seemed to break most lines in the code.
Any suggestions would be really helpful!
Sub Refresh_PlanIDs()
Dim filterList1 As Variant
filterList1 = Array("2019")
filterCol1 = 68 'or whatever column contains the IDs
Dim filterList2 As Variant
filterList2 = Array("Travel")
filterCol2 = 69 'or whatever column contains the names
Dim sourceWS As Worksheet
Set sourceWS = Sheets("report1603894994415")
Dim destinationWS As Worksheet
Set destinationWS = Sheets("Demand Summary by Plan (2)")
lastrowSrc = sourceWS.Range("A" & Rows.Count).End(xlUp).Offset(1).Row
lastrowDest = destinationWS.Range("B" & Rows.Count).End(xlUp).Row
sourceWS.AutoFilterMode = False
sourceWS.Range("$A$1:$DA" & lastrowSrc).AutoFilter Field:=filterCol1, _
Criteria1:=filterList1, Operator:=xlFilterValues
sourceWS.Range("$A$1:$DA" & lastrowSrc).AutoFilter Field:=filterCol2, _
Criteria1:=filterList2, Operator:=xlFilterValues
sourceWS.Range("BH2:BH" & lastrowSrc).SpecialCells _
(xlCellTypeVisible).Copy _
Destination:=destinationWS.Cells(lastrowDest + 1, 2)
If sourceWS.AutoFilterMode Then sourceWS.ShowAllData
Dim MyRange As Range
Dim LastRow2 As Long
'Remove Duplicates
LastRow2 = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row
Set MyRange = ActiveSheet.Range("B10:B" & LastRow2)
MyRange.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub