I'd like to have this macro repeat itself for sheets if they're in the workbook. The only thing to change would be the sheet number. Next grouping would be sheet 7, 6....then 9, 8...and so on. I'd like to to be able to be "infinite" with the number of sheets it could do. Is there a way to write so it adds 2 sheets after running the previous section? And I'd like to have it do the next section, if the previous section has run. Any suggestions?
MyFileName = Sheets(5).Range("D3").Value
MyFileNameTwo = Sheets(5).Range("E2").Value
MyFileNameThree = Sheets(5).Range("E1").Value
ChDir MyFileName
Sheets(4).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(MyFileNameTwo & ".pdf"), Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Sheets(5).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(MyFileNameThree & ".pdf"), Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Sheets(1).Select
Range("A1").Select
MyFileName = Sheets(5).Range("D3").Value
MyFileNameTwo = Sheets(5).Range("E2").Value
MyFileNameThree = Sheets(5).Range("E1").Value
ChDir MyFileName
Sheets(4).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(MyFileNameTwo & ".pdf"), Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Sheets(5).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(MyFileNameThree & ".pdf"), Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Sheets(1).Select
Range("A1").Select