Print worksheet using VBA Code

  • I have an Excel workbook, with many worksheets, I have one worksheet that is used for a Central Command Center, it will tell me general information about all the other worksheets and with that information, I will know if specific worksheets need to be printed. The worksheets that need printed are already formatted, I just need to print those out, (which contain over a hundred pages each) but not all pages will need to print from any given worksheet. I am looking for a Command Button to be used to print a worksheet, that is already formatted with multiple pages, but I don’t want to go to the worksheet and have to do a CTRL-P and change the from/to pages, to print the pages I want printed off. The print will always start with the first page, but I am looking to control how many pages to print, it could be over 100. Last, I would like to be able to set this up so that the printer always uses “one sided print”, because the printer I use is defaulted to a “two sided print”. I know these are many things to ask for, but I feel it can be done. Thank you in advance for your solution.


  • I'm trying to make it work, but between not understanding it and it not working the way I feel it should, because I can't find the PDF that it creates. I just want to be able to print from the CONFIGURE worksheet, the pages of the CUSTOMER ORDERS worksheet. I'm trying to make it work, I changed out the msgbox and now it looks at the cell B1 from CUST ORDER. I won't give up, but I just have to wrap my head around it. i thank you for putting your time and knowledge in this, i am grateful for your help.


  • Ok, took me a little bit to see what is happening, but I am finally seeing that the module will print off each individual page to a PDF. Even though I cannot figure out what the a, b, i, x, & y is, I believe all I need to do now is correct the printer, correct? Is there also a way to make sure that it will print using "one sided print", my printer driver at work is setup for "two sided printing". What do I correct to print to my printer?

    Thank you so much for your help.


  • As far as I know that is a printer setting and not an excel one.

    If you want to delve into API's, you might be able to do it but it is beyond me.

    If you google "Change printer settings from 2 sided to single sided printing in Excel" you'll see what I mean.

    If you do find it on your computer, see what you get if you have your macro recorder on while setting it to single sided.

    I guess you have a few things to learn.

    Good luck.

    BTW, the PDF's are saved in the same folder as where the excel workbook is saved.

    If you don't want it in PDF format, change that line to


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!