Vba set non contiguous print in Excel
For example, in my WorkSheet I want to print only 2 tables (one table range is "A2:D34" and another table range is "AM47:AQ60") leaving out the rest of the WorkSheet contents.
To do it in Excel, here is the answer:
- Option Explicit
- Sub PrintSetUp()
- ActiveSheet.PageSetup.PrintArea = "A2:D34,AM47:AQ60"
- With ActiveSheet.PageSetup
- .CenterFooter = "Page &P of &N"
- .CenterHorizontally = True
- .CenterVertically = False
- .Orientation = xlLandscape
- .PaperSize = xlPaperA4
- .Zoom = 100
- End With
- End Sub
a) Line 3 - Each range to be printed should be specified with "," in between them as in "A2:D34,AM47:AQ60"".