Sub print_area1()
Range("H1:K10").PrintPreview 'use this one to show preview before printing
' Range("H1:K10").PrintOut 'use this one to print without showing preview
End Sub
Sub print_area2()
Range("A1:C10").PrintPreview 'use this one to show preview before printing
' Range("A1:C10").PrintOut 'use this one to print without showing preview
End Sub
Thanks.Hi,
This should probably be in the VBA section...
In any case, you may want to try the following:
Code:Sub print_area1() Range("H1:K10").PrintPreview 'use this one to show preview before printing ' Range("H1:K10").PrintOut 'use this one to print without showing preview End Sub Sub print_area2() Range("A1:C10").PrintPreview 'use this one to show preview before printing ' Range("A1:C10").PrintOut 'use this one to print without showing preview End Sub
Hope this helps
This should do it:Thanks.
One more thing usually i print only two setup.
So, I need if suppose A1=1 then print area is H1:K10 if A1=2 then Print area is L1:M10.
One more thing i want to add. Paper Orientation should be landscape. Thanks.
Sub print_area()
ActiveSheet.PageSetup.Orientation = xlLandscape
Select Case Range("A1")
Case Is = 1
Range("H1:K10").PrintPreview
Case Is = 2
Range("L1:M10").PrintPreview
End Select
End Sub
This should do it:
Code:Sub print_area() ActiveSheet.PageSetup.Orientation = xlLandscape Select Case Range("A1") Case Is = 1 Range("H1:K10").PrintPreview Case Is = 2 Range("L1:M10").PrintPreview End Select End Sub
Sub print_area()
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Zoom = 150
End With
Select Case Range("A1")
Case Is = 1
Range("H1:K10").PrintPreview
Case Is = 2
Range("L1:M10").PrintPreview
End Select
End Sub
Hi,
Vertical should be ".Orientation = xlPortrait";
Custom scaling should be ".Zoom = 150":
Code:Sub print_area() With ActiveSheet.PageSetup .Orientation = xlLandscape .Zoom = 150 End With Select Case Range("A1") Case Is = 1 Range("H1:K10").PrintPreview Case Is = 2 Range("L1:M10").PrintPreview End Select End Sub
Sub print_area()
With Sheets("Sheet1").PageSetup
.Orientation = xlLandscape
.Zoom = 150
End With
Select Case Sheets("Sheet1").Range("A1")
Case Is = 1
Sheets("Sheet1").Range("H1:K10").PrintOut copies:=1
Case Is = 2
Sheets("Sheet1").Range("L1:M10").PrintOut copies:=1
End Select
End Sub
Sub print_2sheets()
Sheets("Sheet1").Range("B1:F29").PrintOut
Sheets("Sheet2").Range("H1:L29").PrintOut
End Sub
Sub ExportToPDF()
Range("B1:L29").ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="E:\Shops\" & Range("A2") & ".pdf"
End Sub
Hi,
In the future post the full problem/request right form the start!
To specify the sheet from where to print use "Sheets("Your sheet name here")." before Range... (see below)
In order to specify the number of copies, you will need to use Printout instead (which does not show a preview) (also below)
To print 2 sheets in one go simple add both instructions one after the other (refer to the "print_2sheets()" subroutine)
Export to PDF also below:
Code:Sub print_area() With Sheets("Sheet1").PageSetup .Orientation = xlLandscape .Zoom = 150 End With Select Case Sheets("Sheet1").Range("A1") Case Is = 1 Sheets("Sheet1").Range("H1:K10").PrintOut copies:=1 Case Is = 2 Sheets("Sheet1").Range("L1:M10").PrintOut copies:=1 End Select End Sub Sub print_2sheets() Sheets("Sheet1").Range("B1:F29").PrintOut Sheets("Sheet2").Range("H1:L29").PrintOut End Sub Sub ExportToPDF() Range("B1:L29").ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:="E:\Shops\" & Range("A2") & ".pdf" End Sub
You are welcomeThanks. Again.
Sorry for questioning again and again.
I was just curious to learn more from you.
Did not do intentionaly.
Thanks. Bye.