If you need to Export Each sheet to an individual .pdf file this Macro will do it for you.
It will go through all the sheets in your Workbook and save each one to a separate PDF file using the worksheet name as file name.
' PDF Export Macro
' Change C:\Exports\ to your folder path where you need the diles saved
' Save Each Worksheet to a separate PDF file.
Dim ws As Worksheet
For Each ws In Worksheets
nm = ws.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="C:\Exports\" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
Posted by Excel Instructor:
Submit your review
Hi wonderful VBcode!!
But I am getting an error of
Run-time error '1004'
Method 'Select of object'_Worksheet' failed.
First five sheets exported successfully. But at sixth sheet I am getting this error. Thanks.!
It took me a few tries on the file name, but finally got it working! One more question - how do you change the code to use a cell in the file name as the tab character length is not long enough for the names I need, thanks!
Worked like a charm . thank you so much.
I love this macro. I use it to automate statements that I have to send out. Now I just need to figure out automating the emailing of the statements.
Excel had an issue with the last line before "next ws", might just be my lack of knowledge, but I was not able to use this macro. Maybe a little more instruction would help?
Most likely cause you didn't modify the path to your final folder accurately, no other changes are necessary. Many people were able to use the macro successfully as you can see from comments. Keep in mind that this macro is for Windows Excel users.
Good to see
Great and thanks!
Great! Thank you so much for sharing this. I spend hours doing this every week. Now it's just a click away.