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
Description:
a) Line 3 - Each range to be printed should be specified with "," in between them as in "A2:D34,AM47:AQ60"".
You can find similar Excel Questions and Answer hereunder
1) How can I set the fill color, font color and set number format of cell to date?
2) How can I hide a sheet completely from users (the sheet should not even appear in Unhide dialog box)?
3) How can I find the number of working days between 2 dates using VBA?
4) How can I loop through all ActiveX checkboxes in WorkSheet and set them to Unchecked status?
5) How can I set up ListBox using VBA to allow users to select multiple values?
6) How can I update a listbox based on data in a list using VBA?
7) How can I get row count of filtered data?
8) How can I add a Timestamp after macro execution?
9) I have to enter non alphanumeric characters in a cell using VBA - how can I get their codes for use in VBA?
10) How to use the trace error function in VBA