The way to do that is to find the unique values in the correct field from the data source, and loop through them. For example, if your data is on a sheet and your tow columns of managers are in A and B, with headers in A1 and B1, and column AA is empty, then code like this will find all the current values from A print them to a pdf in the same folder as the Excel file, then do the same for B.
Sub Macro2()
Dim rngC As Range
Dim rngF As Range
With ActiveSheet
'Find the unique values from column A
Set rngF = .Range(.Range("A1"), .Cells(.Rows.Count, "A").End(xlUp))
rngF.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("AA1"), Unique:=True
'Loop through the unique values
For Each rngC In .Range(.Range("AA2"), .Cells(.Rows.Count, "AA").End(xlUp))
rngF.AutoFilter Field:=1, Criteria1:=rngC.Value
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & rngC.Value & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
rngF.AutoFilter
Next rngC
.Range("AA:AA").Clear
'Find the unique values from column B
Set rngF = .Range(.Range("B1"), .Cells(.Rows.Count, "B").End(xlUp))
rngF.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("AA1"), Unique:=True
'Loop through the unique values
For Each rngC In .Range(.Range("AA2"), .Cells(.Rows.Count, "AA").End(xlUp))
rngF.AutoFilter Field:=1, Criteria1:=rngC.Value
.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & rngC.Value & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
rngF.AutoFilter
Next rngC
.Range("AA:AA").Clear
End With
End Sub
Bookmarks