Hello,

I'm very new to VBA, but have been asked to find a way to automate some report appendices. Basically, I have an Excel workbook with multiple worksheets or tabs. Depending upon the user, different worksheets will need to be saved to PDF in different orders. To get around this, I created a summary worksheet (see attached image) that allows user to order each of the model worksheets or tabs (columns E &F). Then, columns I through L rearrange the worksheets or tabs using rankings that are determined from the input appendix numbering.

What I've been trying to do is save only the ordered worksheets listed in column K to PDF using VBA. Given they are report appendices, they need to be saved to PDF as one PDF in the exact order listed in column K. Any help in how to tackle this problem would be greatly appreciated. For starters, I've been trying to modify the following code to achieve this goal, but am not sure if this is at all accurate. Thanks.

Sub Print_To_PDF()
ActiveWorksheet.Sheets(Range(K5:K64)).Select
Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:="C:\TestFolder\temp.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub


Capture.JPG