Applies To
PageSetup Object.
Description
Returns or sets the size of the right margin, in points (1/72 inch). Read-write.
Remarks
Margins are set or returned in points. Use the InchesToPoints or CentimetersToPoints function to convert.
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"