PageSetup.RightMargin Property (Excel)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

expression .RightMargin

expression A variable that represents a PageSetup object.

Margins are set or returned in points. Use the InchesToPoints method or the CentimetersToPoints method to convert measurements from inches or centimeters.

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

Worksheets("Sheet1").PageSetup.RightMargin = _ 

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

Worksheets("Sheet1").PageSetup.RightMargin = _ 

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

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