I have an Excel workbook with 5 sheets(I'm simplifying for clarity here):
'DataMaster'
'CityData S'
'TownData S'
'TownlandData S'
'StreetData S'
Sometimes there are additional sheets/tabs but the sheets to be saved are all suffixed with the ' S' suffix. 'Datamaster' here does not need to be saved.
I wish to export/save to PDF using a loop that
1) Only will look at sheets with rightmost 2 characters in their names being ' S'.
2) Will not care if there 3 or 10 of these sheets.
3) will export to PDF with filename being the leftphrase in the sheetname.
Thus the export would be:
CityData.PDF ,
TownData.PDF ,
TownlandData.PDF ,
StreetData.PDF
Any tips/help would be appreciated, I have the basic export to PDF code only.
You can use a
For Each
loop to loop through every worksheet in your workbook. You can use anIf
to test if theRight()
two characters match.Something like: