BIG PICTURE: Create a script that at the touch of a button will consistently format and save each worksheet as its own .pdf.
WHAT I HAVE SO FAR: I have a working VBA for the formatting and a working VBA for the "Save As... pdf", but I am stuck on how to properly do a VBA reference loop. I have the following script refencing a simple "SheetList" (name of every tab in the workbook). I want the script to repeat for Sheets 1 through x but I can't figure out how to have the same two lines of code repeat until VBA finishes last x sheet. Possibly something with a SheetCount?
VBA is not my strong point, so I appreciate any help I can get.
WHAT I HAVE SO FAR: I have a working VBA for the formatting and a working VBA for the "Save As... pdf", but I am stuck on how to properly do a VBA reference loop. I have the following script refencing a simple "SheetList" (name of every tab in the workbook). I want the script to repeat for Sheets 1 through x but I can't figure out how to have the same two lines of code repeat until VBA finishes last x sheet. Possibly something with a SheetCount?
Code:
Sub SaveAspdf()
Sheets(1).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Desktop\" & Worksheets("SheetList").Range.Cells(1,1), Quality:=xlQualityStandard, OpenAfterPublish:=False
Sheets(2).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Desktop\" & Worksheets("SheetList").Range.Cells(1,2), Quality:=xlQualityStandard, OpenAfterPublish:=False
Sheets(3).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Desktop\" & Worksheets("SheetList").Range.Cells(1,3), Quality:=xlQualityStandard, OpenAfterPublish:=False
End Sub
VBA is not my strong point, so I appreciate any help I can get.