For converting Excel files to PDF you can find various free and paid tools online. Free tools don’t guarantee quality conversion and sometimes you might lose data/formatting after conversion. I don’t recommend you to use any free or premium tool.
The reason is your PC already has built-in features that help you to convert Excel to PDF without losing any data or formatting.
In this tutorial, I will show you how to convert Excel XLSX to PDF without losing formatting applied on the cells.
Using Export as PDF Option
The quick way to convert Excel to PDF is the ‘Export’ option. Export option is only available in the latest version. If you are using Office 2007 then quick jump to the next method.
Follow the step-by-step tutorial on how to use the ‘Export’ option to convert Excel to PDF.
Step 1: Go to File tab, then click on the Export option >> Create PDF/XPS document button.
Step 2: In the Publish As dialogue box, click on the Publish button. Make sure the PDF format has been selected under the ‘Save as type’ box.
Using Quick Access Toolbar
Quick Access Toolbar (QAT) is a toolbar that contains a set of commands such as Save and Undo/Redo. QAT is easily customizable and you can add a new command.
If you need to frequently convert Excel sheets into PDF then it is better to add ‘Publish as a PDF’ command on the QAT.
Follow the step-by-step tutorial on how to use the Quick Access Toolbar to convert Excel sheet to PDF.
Step 1: Go to File tab or Office button, click on the Excel options. In the Excel options dialogue box, click on the Customize tab and then select the ‘All Commands’ option from the ‘choose commands from’ dialogue box.
Step 2: From the All Commands list, select the ‘Publish as PDF or XPS’ command and click on the Add button.
Step 3: Clicking on the Ok button will add command on the QAT. Now you can see you have a new icon added on the QAT toolbar.
When you click on it, a new ‘Publish As PDF’ dialogue box will be opened. The next steps are the same as we discussed in the first method.
In the similar way you can add a new command called ‘E-mail as PDF Attachment’ on the quick access toolbar. Simply go to File tab >> Excel Options >> Customize >> All Commands and then select the ‘E-mail as PDF Attachment’ to add.
Using Save As Dialogue box
The simple method to convert Excel to PDF is the ‘Save As’ dialogue box. Follow the step-by-step tutorial on how to use the ‘Save As’ option to convert Excel to PDF.
Step 1: First, select the range of cells or Excel table that you want to convert. Make sure you have also selected the data including row heading or column heading.
In case you want to convert the entire sheet to PDF then don’t follow this step.
Step 2: Go to File tab or Office button and then open the ‘Save As’ dialogue box by clicking on the ‘Save As’ option. You can directly open the dialogue box by pressing the ‘F12’ shortcut key on the keyboard.
Step 3: In the Save As dialogue box, select the PDF format under the Save as type dropdown.
Step 4: When you choose PDF from the dropdown, the options button in the dialogue box will automatically be enabled. Now click on the Options button.
Step 5: Choose the Selection radio button which is available inside Publish What section in the options dialogue box. Choosing the Selection radio button will help you to convert only what you have selected. In the case you want to convert the entire sheet, choose the Active Sheet(s) radio button.
Step 6: Clicking on the Save button will automatically open the PDF file that you have just published by converting Excel table to PDF.
Using VBA Macro
VBA (Visual Basic for Applications) is another way of converting Excel sheets into PDF format. Using VBA, you can create a macro that automatically converts a selected range or sheet to PDF format and save it in a specified folder.
In Microsoft Office Programs such as Word or Excel, we use the Developer tab to create and manage the macros. In case you are creating a macro for the first time, probably you might not see the developer tab in the ribbon.
You can enable it inside Excel options dialog box (in Excel 2007) or customize the Quick Access Toolbar (in Excel 2010, 2013).
Follow the step-by-step tutorial on how to use the ‘VBA Macro’ to convert Excel to PDF.
Step 1: Go to the Developer tab, click on the Macros icon.
Step 2: Enter a unique name for your new macro. Make sure ‘This Workbook’ option has been selected in the “Macros In” box. If you choose the ‘This Workbook’ option then the macro code that you are creating now will be applied to the current Workbook only.
Step 3: After you click on the create button on the Macro dialogue box will open the new VBA editor window. Now insert the following lines of code in between Sub and End Sub.
The code below will prompt you to provide a range of cells that you want to export and then specify the folder, to automatically export Excel to PDF.
'Declaration of Variables
Dim rng As Range
Dim strFilePath As String
Dim strFile As String
Dim file As Variant
'Check first if a range has been selected
If Selection.Count = 1 Then
Set rng = Application.InputBox("Please select a range", "Get Range", Type:=8)
Set rng = Selection
'Create the filename with the path – the default filename is ExceltoPdf.pdf
strFile = "ExceltoPdf.pdf"
strFile = ThisWorkbook.Path & " \ " & strFile
'We open a save prompt for the username to select the location and filename
file = Application.GetSaveAsFilename(InitialFileName:=strFile, FileFilter:="PDF Files (*.pdf), *.pdf", Title:="Select location for the PDF file")
'Start the export process of the selected range
If file <> "False" Then
rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=file, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
MsgBox "PDF file has been successfully created: " & strFile
MsgBox "Unable to create PDF file", vbOKOnly, "No File Selected"
Step 4: Now close the code editor window and then return to Excel.
Step 5: Again go to the Developer tab and then click on the Macros icon. This will open the Macro dialogue box.
You can directly open the Macro dialogue box by pressing the shortcut key ALT+F8 on the keyboard.
In the macro dialogue box, select the macro name and then click on the Run button.
Step 6: Select the range of cells including row or column header that you want to export. Then press the OK button.
Step 7: Select the location for saving the PDF file and then click the Save button.
This is how you can convert the Excel range ‘$A$1: $L$14’ to PDF.
Using Print Option
In this method we use the Print option to convert an Excel sheet into PDF. You can select the specific cell range too.
Step 1: Select the sheet or specific cell range and then press CTRL+P shortcut key. This will open the print options dialogue box.
Step 2: If you haven’t selected the range then make sure the Active Sheet(s) option is chosen. In case you have selected the range then choose the Selections option under the Print What section. Then press the OK button.
Step 3: In the PDF creator window, specify the new name and location if you wish to change. Then press the save button. After a few seconds, your PDF gets ready and will be opened on the PDF reader.
This is how you can convert Excel sheet to PDF using the print option without losing data and formatting applied on the cell.
In this article, you have learned 5 different methods of converting Excel to PDF format. When you need an Excel file in PDF format for attaching it on the email then use Email As Attachment command from QAT. When you need an Excel file in PDF format for printing then you can use Print option, Save as dialogue box, or Export as PDF method. When you need to change an Excel file into PDF frequently then use VBA macro method.
Read Also: How to Save Excel Chart as Images?