Save as PDF file but exclude blank pages (using macro)

feni1388

Board Regular
Joined
Feb 19, 2018
Messages
133
Office Version
  1. 2021
Platform
  1. Windows
Hello...
I'm making an invoice in excel that has header on the top and detail of the items ordered on the table below.
The details of the items ordered varies widely for each month, so I won't know how long it's going to be.
It can be one page only, two pages, or even three pages.
I need to save it as PDF before sending to customer, so my question is that whether it's possible or not to save the file as PDF but excluding the blank pages?
The header will be there, but I need macro to see a certain cell on the table whether it's empty or not (there'll be formula in it, but the cell will be shown as empty).
If it's empty then that page won't be saved.

I attached the image.
Only the first and the second page that has items details on the table but not the third page.

If anyone can help, I would really appreciate it.
 

Attachments

  • Customer A.PNG
    Customer A.PNG
    90.7 KB · Views: 21

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
if y
Hello...
I'm making an invoice in excel that has header on the top and detail of the items ordered on the table below.
The details of the items ordered varies widely for each month, so I won't know how long it's going to be.
It can be one page only, two pages, or even three pages.
I need to save it as PDF before sending to customer, so my question is that whether it's possible or not to save the file as PDF but excluding the blank pages?
The header will be there, but I need macro to see a certain cell on the table whether it's empty or not (there'll be formula in it, but the cell will be shown as empty).
If it's empty then that page won't be saved.

I attached the image.
Only the first and the second page that has items details on the table but not the third page.

If anyone can help, I would really appreciate it.
if you want to check empty pages, i think you just need to check first cell after title of table that include date, if it blank then no need to covert it to pdf. is that true?
 
Upvote 0
if y

if you want to check empty pages, i think you just need to check first cell after title of table that include date, if it blank then no need to covert it to pdf. is that true?
Yes, that's true.
So the number of pages that is converted to PDF is only 2 pages (according to my sample)
 
Upvote 0
yes, it's going to be in the same sheet.
Easier to make it in the same sheet as I'm going to need to link it to another sheet.
i need to see all row and column address in your form to set for first date cell of invoice and when export to pdf, each invoice in one pdf file right?
 
Upvote 0
I attached again the image including the row and column address.
Each customer's invoice will be in one PDF file.
 

Attachments

  • Customer A.PNG
    Customer A.PNG
    99.6 KB · Views: 9
Upvote 0
to check blank invoice with same customer is easy but your invoice in same sheet and horizontal so to convert it to pdf, you need select invoice and print it as pdf and the problem is it so hard to do it in vba, it each invoice in single sheet, we can easy to check and export it to pdf
 
Upvote 0
to check blank invoice with same customer is easy but your invoice in same sheet and horizontal so to convert it to pdf, you need select invoice and print it as pdf and the problem is it so hard to do it in vba, it each invoice in single sheet, we can easy to check and export it to pdf
Sorry, I don't think I explained it clearly. The sample (3 pages) that I showed you is only for one customer (in one sheet).
What I have in mind actually, is that once I reflected the invoice details of one customer in that form that I showed you, I will save it in PDF.
Then I will go to the next customer.
So basically one customer one sheet.
But when I save in in PDF, I need to exclude the blank pages.
 
Upvote 0
As suggested previously.
Change your setup to have the 3 invoices under each other.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top