OK, this should do.
Sub test()
Dim myMonth, myMonths, myName, txt As String
myMonths = Array("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec")
Sheets("result").UsedRange.Clear
With Sheets("source").Cells(1).CurrentRegion
.Rows(1).Copy Sheets("result").Cells(1)
myMonth = Application.Match(.Parent.Range("i1"), myMonths, 0)
If IsNumeric(myMonth) Then txt = "year(a2)=year(today()),month(a2)=" & myMonth
If .Parent.[h1] <> "" Then txt = txt & IIf(txt <> "", ",", "") & "b2=h$1" '<--- fixed a bug
.Parent.[m2].Formula = "=and(" & txt & ")"
.AdvancedFilter 2, .Parent.[m1:m2], Sheets("result").Cells(1).CurrentRegion
.Parent.[m2].Clear
Sheets("result").Select
End With
End Sub
Bookmarks