Vba set zoom tile rows footer in Excel

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Sub PrintSetUp()
  3. ActiveSheet.PageSetup.PrintArea = "AP2:AR14"
  4. With ActiveSheet.PageSetup
  5. .PrintTitleRows = "$2:$2"
  6. .PrintTitleColumns = ""
  7. .CenterFooter = "Page &P of &N"
  8. .CenterHorizontally = True
  9. .CenterVertically = False
  10. .Orientation = xlLandscape
  11. .PaperSize = xlPaperA4
  12. .Zoom = 100
  13. End With
  14. End Sub


a) Line 5 - The rows specified (in the code above it is row 2) in Line 5 would appear in every page that is printed. In this example, since there is only one Page for Print, this command does not make a difference.

b) Line 6 - The columns specified (in the code above no column is specified as the print range does not span 2 pages) in Line 6 would appear in every page that is printed.

c) Line 7 - "&P" is the Page No and "&N" is the total number of pages. When the above code is executed, footer appears as "Page 1 of 1".

d) Line 10 - If Portrait printing is required, the field can be changed to xlPortrait instead of xlLandscape.


You can find similar Excel Questions and Answer hereunder

1) How can I find the number of working days between 2 dates using VBA?

2) How do I enter a formula in a cell using VBA (using Absolute Reference)?

3) How do I add a shape using VBA?

4) The name manager in Excel is very useful to keep an overview and manage all the variable names in Excel. Here how to use the name manager in VBA

5) Tables in Excel VBA. How you can create table in VBA and work with them with macros

6) Here a explanation about the global seek function in VBA. Goal Seek is another tool under What If analysis that does a unique function as Scenario Manager.

7) How to concatenate strings in vba in Excel

8) Here some explanations about XPATH. XPath is a syntax for defining parts of an XML document

9) How can I remove display of Gridlines in my worksheet using VBA?

10) Excel 2010 vba replacement of application filesearch in Excel


Here the previous and next chapter