我需要为AQ列中列出的每个ID生成一个PDF。我正在尝试编写一个代码:
这是我到目前为止的代码
Sub GeneratePDF()
Dim r As Range, cell As Range
Set r = Range(Range("AQ1"), Range("AQ1").End(xlDown))
For Each cell In r
Sheets("Specialist Roster").Select
Range("H2").Select
Selection.Copy
Sheets("Weekly Productivity").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ManagerName = Range("O5").Value
SpecialistName = Range("Q1").Value
Folder = Range("Q2").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Users\sdevereueawax\Desktop\Weekly Productivity Reports\" & ManagerName & "\" & SpecialistName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=True, _
OpenAfterPublish:=False
End Sub