TopMargin Property 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"