The need to change page orientation in Excel can arise for a variety of reasons, such as needing to fit spreadsheet content onto the paper size, improve the readability of a text-heavy report, or maintain consistency with other documents. Regardless of the purpose, knowing the different options available is crucial for optimizing the presentation and printing of your data in Excel.
In this article, we will explore in detail seven effective methods for changing the page orientation in Excel, offering a comprehensive overview of the features and tools available. Whether you’re using the Page Setup options, the Page Setup dialog box, or VBA and Office Scripts, you’ll have a range of versatile solutions to adapt the appearance of your worksheets to your needs.
1. Change Page Orientation from the Page Setup Tab
The Page Setup tab on the Excel ribbon provides several standard options for page configuration, including setting the orientation. Here’s how to proceed:
- Open the Excel worksheet you are interested in.
- Click on the Page Setup tab on the ribbon.
- In the Orientation group, select either Portrait or Landscape based on your requirements.
- Portrait orientation allows you to fit more rows on a page, while landscape orientation allows you to fit more columns but fewer rows.
This simple and intuitive procedure allows you to quickly change the page orientation without navigating through complex menus.
2. Use the Page Setup Dialog Box
If you prefer using keyboard shortcuts to avoid manual clicks, here’s how to change the page orientation using the Page Setup dialog box:
- Ensure you are on the Home tab of your Excel worksheet.
- Press the
Altkey, then pressH,P,S, and thenPto open the Page Setup dialog box. - On the Page tab, find the Orientation option and select either Portrait or Landscape according to your needs.
- Click OK to confirm the changes.
- You will notice a dashed line (horizontal for landscape orientation and vertical for portrait) that defines the printable area of the worksheet.
- Make sure to adjust your worksheet content within this defined area to ensure all data is included in the printout.
This procedure offers quick and convenient access to page orientation settings without manually navigating through various tabs and menus.
3. Change Orientation During Printing
If you don’t want to see any dashed lines on your worksheet while working on data analysis and visualization, you can change the orientation directly during the printing phase. Here’s how:
- Once you’re ready to print your Excel report, press
Ctrl+Pon your keyboard. - This will open Excel’s print preview.
- In the Settings section, you should see the Landscape Orientation option.
- Click the dropdown menu and select Portrait Orientation.
- The print preview will update to show the printable area.
- If the print preview doesn’t look satisfactory, click the back arrow to return to the Home tab.
- At this point, adjust the rows and columns to fit the content within the dashed line.
- Execute the print command again, and the preview should now be correct.
Keep in mind that by default, all Excel worksheets have Landscape Orientation in the print preview. You will need to manually change it to Portrait Orientation if that’s your preference.
4. Change Page Orientation for Multiple Worksheets
Suppose you have multiple worksheets within a single Excel file. If you want to set all sheets to Portrait orientation for printing needs, here’s how to proceed:
- Hold down
Ctrland select all the worksheets in the menu at the bottom. - Now, click on the Page Setup tab and choose your desired orientation, either Landscape or Portrait.
- Go through the individual worksheets, and you should see that all are set to the selected orientation.
This procedure allows you to quickly change the orientation for all worksheets within a single Excel file, simplifying preparation for printing.
5. Create an Excel Template with Custom Orientation
If you frequently use an Excel template, you won’t have to worry about changing the orientation of each individual worksheet before printing. All you’ll need to do is open the template, copy in your new data, and print the file or selected sheets.
Suppose you have an Excel file with the page orientation already adjusted. Here are the steps to save it as a template:
- Click on the File tab and select Save As.
- In the Save As pane, click Browse under the Save section.
- In the Save As dialog box, choose the destination directory for your new file.
- Click on the Save as type dropdown list and select Excel Template (XLTX).
- Click the Save button to complete the process.
When you need to use the template, navigate to the directory where you saved it and open it. Make the necessary changes, such as importing new data or updating an existing chart. Press Ctrl + S to save the file with a new name. You can then simply print the content, and it will have the previously set page orientation.
6. Change Page Orientation in Excel Using a VBA Script
Suppose you want to automate the process of changing page orientation in Excel. For this purpose, we can use the following VBA script. The script converts the page orientation to Portrait if the existing orientation is Landscape, and vice versa. Here are the steps to create and run the macro:
- Press
Alt+F11to open the Excel VBA Editor. - Click Insert and select Module from the toolbar in the VBA Editor.
- Copy and paste the following script into the blank module:
Sub TogglePageOrientation() If ActiveSheet.PageSetup.Orientation = xlLandscape Then ActiveSheet.PageSetup.Orientation = xlPortrait Else ActiveSheet.PageSetup.Orientation = xlLandscape End If End Sub
- Click the Save button and close the VBA Editor.
- Now, press
Alt+F8together to open the Macro dialog box. - Select the TogglePageOrientation macro and click the Run button to execute the VBA script.
- Excel will automatically change the page orientation to Portrait if it was Landscape, and vice versa, on the active worksheet.
You can also attach this small script to your VBA project. Then, when you run the main macro, Excel will process all tasks and finally set the desired page orientation. This way, you can go directly to print preview by pressing Ctrl + P, without needing to run an additional VBA macro.
7. Change Page Orientation in Excel Using Office Scripts
If you are using the Excel desktop app for Microsoft 365 or the Excel web app, you can leverage Office Scripts for advanced automation. However, you will need an active Microsoft 365 subscription on your account. If you see the Automate tab in your Excel web app or desktop app, you can use it to convert page orientation in Excel. Here’s how:
- Click on the Automate tab and select the New script button.
- The Code Editor will appear on the right side of the Excel app.
- Delete the existing code and copy and paste the following script:
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
// Set the print area for the selected sheet within the range "A1:I31"
selectedSheet.getPageLayout().setPrintArea("A1:I31");
// Set ExcelScript.PageOrientation.portrait orientation for the selected sheet
selectedSheet.getPageLayout().setOrientation(ExcelScript.PageOrientation.portrait);
// Set the paper size to Letter for the selected sheet
selectedSheet.getPageLayout().setPaperSize(ExcelScript.PaperType["Letter"]);
// Set the zoom to "without scaling" for the selected sheet
selectedSheet.getPageLayout().setZoom({scale: 100});
}
- Click the Save script button and then click the Run button in the Code Editor.
- This will change the orientation of a page in Excel from Landscape to Portrait.
If your Excel worksheet is already in Portrait orientation and you need to set it to Landscape, you will need to change all occurrences of portrait to landscape.
You can include this Office Scripts code in your existing project. Then, by running the main script, all the tasks you’ve coded will be performed, and the page orientation will be automatically set to either Portrait or Landscape.
These are all the most common methods for changing page orientation in Excel. You can use the Page Setup tab, the Page Setup dialog box, or print preview to manually set the appropriate page orientation.
If your worksheet has automation based on VBA or Office Scripts, you can include the provided VBA scripts and Office Scripts code to make the page orientation selection process fully automated. Do you know of any other tips for setting page orientation? Let us know in the comments below!

Be the first to comment