In Excel we can opt to print out with very narrow margins through its interface. We can do the same thing with Excel Macros, you can print with a narrow margin, or even customize the margin values so that it will be constant every time!

Make sure your Excel has the Developer Tab enabled following this tutorial.

I explain how you can do this below step by step!

What does it do?

Prints out with narrow margins then shows the print dialog

Copy Source Code:

Sub PrintWithNarrowMargin()

'Set the Margins to be narrow and print it out
With ActiveSheet.PageSetup
.HeaderMargin= Application.InchesToPoints(0.3)
.FooterMargin= Application.InchesToPoints(0.3)
.LeftMargin= Application.InchesToPoints(0.25)
.RightMargin= Application.InchesToPoints(0.25)
.TopMargin= Application.InchesToPoints(0.75)
.BottomMargin= Application.InchesToPoints(0.75)
End With


End Sub

Final Result: 

Exercise Workbook:


This is our data table:

STEP 1: Go to Developer > Code > Visual Basic


STEP 2: Paste in your code and Select Save. Close the window afterwards.


STEP 3: Let us test it out!

Open the sheet containing the data. Go to Developer > Code > Macros


Make sure your macro is selected. Click Run.

The Print Dialog is shown. Click OK once settings are good.

With just one click, you have now printed out with narrow margins!



How to Print with a Narrow Margin Using Macros In Excel



101 Macros Book

If you like this Excel tip, please share itEmail this to someone


Pin on Pinterest

Share on Facebook

Tweet about this on Twitter

Share on LinkedIn