This should do it:
Option Explicit
Sub MakeBooks()
Dim fPATH As String, Month As String, LR As Long, Rw As Long
Dim wsData As Worksheet, buf As String, Nms As Variant, Nm As Long
Month = Application.InputBox("What month?", "Month", "January", Type:=2)
If InStr("JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember", Month) = 0 Then
MsgBox "That was not a month string."
Exit Sub
End If
fPATH = "C:\2012\Test\" 'remember the final \ in this string
With Sheets("Tracker")
On Error Resume Next
.ShowAllData
On Error GoTo 0
LR = .Range("A" & .Rows.Count).End(xlUp).Row
For Rw = 2 To LR
If InStr(buf, .Range("B" & Rw) & ",") = 0 Then buf = buf & .Range("B" & Rw) & ","
Next Rw
Nms = Split(buf, ",")
.Rows(1).AutoFilter Field:=3, Criteria1:="*" & Month & "*"
For Nm = 0 To UBound(Nms)
If Len(Nms(Nm)) > 0 Then
.Rows(1).AutoFilter Field:=2, Criteria1:=Nms(Nm)
LR = .Range("A" & .Rows.Count).End(xlUp).Row
If LR > 1 Then
.Range("A1").CurrentRegion.Copy
Sheets.Add
Range("A1").PasteSpecial xlPasteAll
ActiveSheet.Move
Columns.AutoFit
ActiveWorkbook.SaveAs Nms(Nm) & " - " & Month & ".xlsx", FileFormat:=51
ActiveWorkbook.Close False
End If
End If
Next Nm
.ShowAllData
End With
End Sub
Bookmarks