Hi Guys thanks for letting me join up
I am trying to get a VBA to create a PDF of my worksheets (combined sheets, not separate pdf's).
The following works perfectly except when BBB (for example) is not in the excel sheet, how do I get the VBA to ignore missing worksheets and still create a PDF of the ones that are included?
I've been searching and searching for this and have gained a basic idea about 'resume next' and 'goto' but as the sheet search is looking through an array I have convinced myself that it's not possible... there must be another way though ?!
I am trying to get a VBA to create a PDF of my worksheets (combined sheets, not separate pdf's).
The following works perfectly except when BBB (for example) is not in the excel sheet, how do I get the VBA to ignore missing worksheets and still create a PDF of the ones that are included?
I've been searching and searching for this and have gained a basic idea about 'resume next' and 'goto' but as the sheet search is looking through an array I have convinced myself that it's not possible... there must be another way though ?!
VBA Code:
Sub CWNformatSelective()
Sheets(Array("Cover", "AAA", "BBB", "CCC", "DDD")).Select
Sheets("AAA").Activate
ChDir "C:\Downloads"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Downloads\Creation.pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub