You will find the selected range of cells saved into a PDF file. Enter the name you want to save the new PDF with and click OK.You will see a prompt asking you to enter a name for the new PDF. Select the name SaveSelectionToPDF from the list of macros displayed. Click on Macros, under the Developer tab.Now go to your worksheet and select the range of cells that you want to save to PDF (cells A1:F18 in our example).
#Change print area in excel 2010 code
Select Export from the options on the left sidebar.It takes advantage of Excel’s built-in PDF converter. This method is suitable for you if you are using Excel versions 2007 and higher. Method 2: Saving a Selection to PDF using the Publish As Dialog Box The good thing, however, is that this is just a copy, so your original Excel sheet remains preserved the way it was. Note: Once you have converted to PDF, you cannot revert it back into an Excel sheet. If you had checked the box next to ‘ Open file after publishing’, Excel will open your saved selection in your default browser or PDF viewer. Finally, click on Save to save the selection and close the Save As dialog box.You will see more options at the bottom of the Save As dialog box, like options for optimizing your PDF file, and opening the PDF file after publishing.Click OK to close the Options dialog box.Under the ‘ Publish what’ section, select the radio button next to the ‘Selection’ option.This will further open a new dialog box for you to enter your options.Click on the Options button (located towards the bottom of the dialog box).From the dropdown menu that appears, select PDF.In the field next to ‘ Save As Type’, click on the dropdown arrow.In the field next to ‘ File Name’, type the name you want to give the new file, if you want to save the PDF with a different name. This will open the Save As dialog box.If you are asked which folder you want to save to, then select the relevant folder.Select Save As from the options on the left sidebar (if you’re on older versions of Excel, select Save As from the File menu).In our example, we will select the range A1:F18. Select the range of cells that you want to save in the PDF file.To save a selected range of cells to PDF, here are the steps that you need to follow: This is a very commonly used method as it is simple and can usually be applied to any Excel version. Method 1: Saving a Selection to PDF using the Save As Dialog Box We will apply the above three methods to save only the shaded portion of the sheet to PDF. Throughout this tutorial, we will be using the following dataset. Method 3: Saving a Selection to PDF using VBA.Method 2: Saving a Selection to PDF using the Publish As Dialog Box.Method 1: Saving a Selection to PDF using the Save As Dialog Box.