Skip to content

Latest commit

 

History

History
53 lines (32 loc) · 1.26 KB

Excel.PageSetup.TopMargin.md

File metadata and controls

53 lines (32 loc) · 1.26 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
PageSetup.TopMargin property (Excel)
vbaxl10.chm473102
vbaxl10.chm473102
Excel.PageSetup.TopMargin
1c4efb20-844c-b602-48b4-ef60b8e5dda5
05/03/2019
medium

PageSetup.TopMargin property (Excel)

Returns or sets the size of the top margin, in points. Read/write Double.

Syntax

expression.TopMargin

expression A variable that represents a PageSetup object.

Remarks

Margins are set or returned in points. Use either the InchesToPoints method or the CentimetersToPoints method to do the conversion.

Example

These two examples set the top margin of Sheet1 to 0.5 inch (36 points).

Worksheets("Sheet1").PageSetup.TopMargin = _ 
 Application.InchesToPoints(0.5) 
 
Worksheets("Sheet1").PageSetup.TopMargin = 36

This example displays the current top-margin setting.

marginInches = ActiveSheet.PageSetup.TopMargin / _ 
 Application.InchesToPoints(1) 
MsgBox "The current top margin is " & marginInches & " inches"

[!includeSupport and feedback]