Sub topic 4
Orientation, paper size, and margins
This chapter covers the three settings that fix the size of the printable rectangle on every page. Later chapters on scaling, page breaks, and headers depend on that rectangle. It assumes you can use the Page Layout tab, select ranges, and tell a worksheet from a workbook. It also assumes you have seen where Excel draws automatic page breaks (covered in the first chapters of this tutorial).
How the three settings combine
Excel starts with the physical sheet of paper, subtracts the margins, and fills what remains with cells. The remaining rectangle is the printable area of the page. Not to be confused with the print area, it is the space available for content, not the range you chose to print.
Each setting changes this rectangle in a different way:
- Paper size sets the outer dimensions.
- Orientation decides which dimension is the width and which is the height.
- Margins shrink the rectangle from each edge.
Changing any one input changes where Excel inserts automatic page breaks. If a column suddenly moves to a second page, one of these three settings is the first thing to check.
Where the settings live
The Page Layout tab has a Page Setup group with three drop-down buttons: Margins, Orientation, and Size. These are quick presets. The small arrow in the group's lower-right corner opens the Page Setup dialog box, which has the complete set of options on four tabs: Page, Margins, Header/Footer, and Sheet.
- Page tab: orientation, paper size, scaling, print quality, and first page number.
- Margins tab: all six margin values and the centering options.
Page setup belongs to each sheet, not to the workbook. A workbook with five sheets can have five different orientations and paper sizes. When you open the dialog, you change only the active sheet unless several sheets are grouped. Grouped sheets are covered in the warning below.
Orientation
Orientation has two values: Portrait (taller than wide) and Landscape (wider than tall). Choose Page Layout > Orientation, or use the Orientation box on the Page tab of the dialog.
Orientation does not rotate or resize your data. It swaps the page's width and height. The effect depends on the shape of your content, and the numbers below show how much it matters. They assume US Letter paper, Normal margins, and unscaled content (100%).
| Setting | Printable width | Printable height | About how many default columns fit | About how many default rows fit |
|---|---|---|---|---|
| Portrait | 7.0 in | 9.6 in | 10 | 46 |
| Landscape | 9.5 in | 7.1 in | 14 | 34 |
These counts use the default column width (8.43 characters, about 0.67 in) and the default row height (15 points, about 0.21 in). Your own columns will differ, but the relationship holds. Landscape gives more width and less height.
A practical rule for choosing:
- Wide tables with many columns and few rows usually suit landscape.
- Long lists with a few columns usually suit portrait.
- If a sheet is wide and long, choose the orientation that makes the page count smallest, then use scaling to finish the job.
Orientation is stored separately for each sheet. Chart sheets (a chart on its own tab) also have it, and charts often look better in landscape.
Paper size
Choose Page Layout > Size, or the Paper size box on the Page tab. Common sizes are:
| Name | Dimensions | Typical region |
|---|---|---|
| Letter | 8.5 × 11 in | United States, Canada |
| Legal | 8.5 × 14 in | United States |
| Tabloid (Ledger) | 11 × 17 in | United States |
| A4 | 210 × 297 mm (8.27 × 11.69 in) | Most other countries |
| A3 | 297 × 420 mm | Most other countries |
Three points cause most paper size problems:
- The list comes from the printer driver. Excel shows the sizes that the currently selected printer reports. If you change printers, the list changes. A size that was available on one printer may be missing on another, and Excel may substitute a different size.
- The default depends on the system. A new workbook uses the default paper size of the default printer or the regional settings of the computer. A workbook made in the US and opened in Germany keeps Letter, because the setting is saved in the file. The printer there may hold A4 paper.
- PDF export uses the page setup size. When you export to PDF, the PDF page has the size defined in the sheet's page setup. A Letter sheet exports to a Letter PDF, even if you are in an A4 country. Set the size you want the reader to receive before you export.
If the paper size you need is not in the list, choose More Paper Sizes at the bottom of the Size menu. The options that appear depend on the driver. Some drivers allow custom sizes, and many do not.
Margins
A margin is the blank space between the edge of the paper and your content. Excel has six margin values:
- Top, Bottom, Left, Right: the distance from each paper edge to the cell content.
- Header and Footer: the distance from the top edge to the header text, and from the bottom edge to the footer text.
The Margins button offers presets:
| Preset | Top / Bottom | Left / Right | Header / Footer |
|---|---|---|---|
| Normal | 0.75 in | 0.7 in | 0.3 in |
| Wide | 1 in | 1 in | 0.5 in |
| Narrow | 0.75 in | 0.25 in | 0.3 in |
The values above can differ slightly between Excel versions and regional settings. Open Custom Margins and read the numbers, because the dialog shows the exact values in use. Note that the earlier table in this chapter used 0.7 in for all four sides in its arithmetic only as an approximation. It uses 0.75 in left and right for Letter in older presets. Treat those counts as estimates.
The Margins tab also shows a preview of the page with draggable margin lines. For a quick adjustment, open Print Preview (Ctrl+P) and click Show Margins at the bottom right. You can then drag margin lines and column boundaries directly.
Header and footer margins
The Header and Footer values must be smaller than the Top and Bottom values. If the header margin is 0.5 in and the top margin is 0.4 in, header text overlaps your first row of data. This is a frequent cause of header text colliding with the table. When you reduce a top or bottom margin, reduce the header or footer value too. Headers and footers themselves are covered in a later chapter.
Centering on the page
At the bottom of the Margins tab are two check boxes: Horizontally and Vertically. They center the printed content within the margins. Use Horizontally for a narrow table on a wide page, so it does not hug the left edge. Use Vertically for a short summary that should sit in the middle of the sheet, such as a form or a cover table.
Margins and the printer's limits
Every printer has an unprintable border, usually a few millimeters. If you set a margin smaller than that limit, Excel warns you that one or more margins are set outside the printable area. On paper, the content at the edge will be clipped. Narrow presets work on most laser printers, but a margin of 0 will almost always be cut off. A PDF has no such hardware limit, though a reader who later prints the PDF meets the limit of their own printer.
A worked example
Suppose a sales sheet has 16 columns of default width and 40 rows. At Letter portrait with Normal margins, about 10 columns fit across, so columns K through P spill onto separate pages. Follow these steps:
- Choose Page Layout > Orientation > Landscape. About 14 columns now fit, but two or three columns still spill over.
- Choose Page Layout > Margins > Narrow. The width grows to about 10.5 in, which fits roughly 15 default columns.
- Open Custom Margins and check that the header and footer values are still smaller than the top and bottom values.
- Check the layout in Print Preview.
If a few columns still spill over, margins have run out of room, and the next tool is scaling, which the next chapter explains. Changing margins is a good first step, but do not shrink them past what is readable or printable just to avoid scaling.
Setting them with VBA
Everything in this chapter can be set in a macro. Margins in VBA are measured in points, where 72 points equal one inch. Use Application.InchesToPoints to convert, so you can think in inches.
Sub SetupPageBasics()
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.CenterHorizontally = True
.CenterVertically = False
End With
End SubUse xlPaperA4 instead of xlPaperLetter for A4. The PageSetup object is slow, because each property change can query the printer driver. For a macro that sets many properties across many sheets, set Application.PrintCommunication = False before the changes and True afterward. Always set it back to True, even if an error occurs, or later page setup changes will not take effect.
Common errors
- Changing the printer, then the layout shifts. The new driver reports different paper sizes or an unprintable border. Reopen the Page tab and confirm the paper size.
- Landscape applied to the wrong sheet. Check that no sheets are grouped.
- Header text overlaps data. The header margin is larger than the top margin.
- Content is cut off at the edge on paper but not in preview. The margin is inside the printer's unprintable border.
- The PDF is the wrong size. The sheet's paper size does not match what you wanted to deliver.
- A new sheet has different settings from the others. Page setup is per sheet. A new sheet takes the defaults, not a copy of another sheet's setup. To copy settings, copy the whole sheet, or group sheets and set them together.
Exercise
A worksheet is set to Letter, Portrait, Normal margins. A table is 13 default-width columns wide, and the last three columns print on a second page. You must not change the scale. Which two settings could you change to fit all 13 columns on one page, and which one will you check afterward to avoid a layout problem?
Show answer
Change the orientation to Landscape (about 14 default columns fit) and, if needed, reduce the left and right margins, for example with the Narrow preset. Afterward, check that the header and footer margins are still smaller than the top and bottom margins, and that the left and right margins are not smaller than the printer can print.
Exercise
You build a workbook in the US with Letter paper and email the PDF export to a colleague in Germany who prints on A4. Which setting decides the size of the exported PDF page, and what should you do before exporting?
Show answer
The paper size in the sheet's page setup decides the PDF page size, not the printer you print on or the reader's region. Before exporting, set the paper size to A4 (Page Layout > Size > A4, or .PaperSize = xlPaperA4 in VBA) and check the layout again, because narrower A4 pages can move page breaks.
Exercise
In VBA, you want a left margin of 0.5 inch. Why does .LeftMargin = 0.5 give the wrong result, and what is the correct statement?
Show answer
VBA margins are measured in points, not inches, so 0.5 is only half a point. Use .LeftMargin = Application.InchesToPoints(0.5), which sets 36 points.