PDA

View Full Version : PRINT MACRO



bob71
12-29-2009, 01:17 PM
Hi
I have a project were the user activates a worksheet thru a userform.
What I need to do is specify a range of cells to be printed from the active worksheet as the user clicks the print command button.

The worksheet has data in A to E coloumns and upto 48 rows. What I want when the user clicks the print button is that only A1 to D48 is printed and I do not want the page breaks to be visible and cell E to be printed.

Thanks in advance

GTO
12-29-2009, 11:40 PM
...and I do not want the page breaks to be visible and cell E to be printed.

Thanks in advance

Greetings Bob,

Not sure what that last bit means. If you mean you do not want Column E to be printed, try:

Option Explicit

Private Sub CommandButton1_Click()

With ActiveSheet
.PageSetup.PrintArea = "$A$1:$D$48"
.PrintOut Copies:=1
.PageSetup.PrintArea = ""
.DisplayPageBreaks = False
End With

End Sub


Hope that helps,

Mark

bob71
12-30-2009, 07:29 AM
Thanks mark...its working fine....but just need to add some more criteria....

1.printing to be in Landscape mode
2.Margins on all 4 sides
3.Font size to be increased

Thanks in advance
BOB

bob71
12-30-2009, 11:42 AM
Hi
need to add a couple of criteria to this print macro.

1. Print in landscape mode
2. Give margins to all sides
3. Increase font size

This is the macro i'm using now and its working fine......just to add these 3 criteria.

thanks in advance
BOB
********************************************************

Option Explicit

Private Sub CommandButton1_Click()

With ActiveSheet
.PageSetup.PrintArea = "$A$1:$D$48"
.PrintOut Copies:=1
.PageSetup.PrintArea = ""
.DisplayPageBreaks = False
End With

End Sub

Bob Phillips
12-30-2009, 12:08 PM
Private Sub CommandButton1_Click()

With ActiveSheet

.PrintOut Copies:=1
.DisplayPageBreaks = False

With .PageSetup

.PrintArea = "$A$1:$D$48"
.LeftMargin = Application.CentimetersToPoints(2)
.RightMargin = Application.CentimetersToPoints(2)
.TopMargin = Application.CentimetersToPoints(2)
.BottomMargin = Application.CentimetersToPoints(2)
.Orientation = xlLandscape
.Draft = False
.Zoom = 110
End With
End With

End Sub