Skip to content

Latest commit

 

History

History
58 lines (36 loc) · 1.39 KB

Excel.PageSetup.RightMargin.md

File metadata and controls

58 lines (36 loc) · 1.39 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
PageSetup.RightMargin property (Excel)
vbaxl10.chm473101
vbaxl10.chm473101
Excel.PageSetup.RightMargin
9c392522-2a06-c76f-2f7a-0fb93c947d39
05/03/2019
medium

PageSetup.RightMargin property (Excel)

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

Syntax

expression.RightMargin

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

This example sets the right margin of Sheet1 to 1.5 inches.

Worksheets("Sheet1").PageSetup.RightMargin = _ 
 Application.InchesToPoints(1.5)

This example sets the right margin of Sheet1 to 2 centimeters.

Worksheets("Sheet1").PageSetup.RightMargin = _ 
 Application.CentimetersToPoints(2)

This example displays the current right-margin setting for Sheet1.

marginInches = Worksheets("Sheet1").PageSetup.RightMargin / _ 
 Application.InchesToPoints(1) 
MsgBox "The current right margin is " & marginInches & " inches"

[!includeSupport and feedback]