Results 1 to 3 of 3

Need help in the given Macros Recorded Coding

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    50

    Need help in the given Macros Recorded Coding

    Hi,

    I have recorded the continous process of formatting excel sheet for printing in Macros. So now i got the same in VBA coding. In which i have selected the Page nos need to be printed in the footer as " Page 1 of 20, then 2 of 20 things like this. For this need to print in footer, i have selected the option in the footer as " Page 1 of ?". But the macros just printing them as "Page 1 of ?" in all the pages. Will anybody can help what need to be updated there to get desired result.

    My Recorded Coding.

    Sub Macro5()
    '
    ' Macro5 Macro
    '
    ' Keyboard Shortcut: Ctrl+m
    '
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
    .PrintTitleRows = ""
    .PrintTitleColumns = ""
    End With
    Application.PrintCommunication = True
    ActiveSheet.PageSetup.PrintArea = ""
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = ""
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = "Page 1 of ?"
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0.5)
    .RightMargin = Application.InchesToPoints(0.2)
    .TopMargin = Application.InchesToPoints(0.5)
    .BottomMargin = Application.InchesToPoints(0.5)
    .HeaderMargin = Application.InchesToPoints(0.3)
    .FooterMargin = Application.InchesToPoints(0.2)
    .PrintHeadings = False
    .PrintGridlines = False
    .PrintComments = xlPrintSheetEnd
    .PrintQuality = 600
    .CenterHorizontally = False
    .CenterVertically = False
    .Orientation = xlPortrait
    .Draft = False
    .PaperSize = xlPaperLetter
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = 80
    .PrintErrors = xlPrintErrorsDisplayed
    .OddAndEvenPagesHeaderFooter = False
    .DifferentFirstPageHeaderFooter = False
    .ScaleWithDocHeaderFooter = True
    .AlignMarginsHeaderFooter = True
    .EvenPage.LeftHeader.Text = ""
    .EvenPage.CenterHeader.Text = ""
    .EvenPage.RightHeader.Text = ""
    .EvenPage.LeftFooter.Text = ""
    .EvenPage.CenterFooter.Text = ""
    .EvenPage.RightFooter.Text = ""
    .FirstPage.LeftHeader.Text = ""
    .FirstPage.CenterHeader.Text = ""
    .FirstPage.RightHeader.Text = ""
    .FirstPage.LeftFooter.Text = ""
    .FirstPage.CenterFooter.Text = ""
    .FirstPage.RightFooter.Text = ""
    End With
    Application.PrintCommunication = True
    End Sub
    Last edited by BALA1983; 11-14-2014 at 04:49 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macros not recording...please help
    By Architeuthis in forum Access Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2012, 08:33 AM
  2. Training: More on how to use macros in Excel: Recording Macros
    By ToriT in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-10-2006, 03:10 PM
  3. Replies: 1
    Last Post: 01-10-2006, 04:50 PM
  4. [SOLVED] Recording Macros
    By Richard in forum Excel General
    Replies: 1
    Last Post: 08-16-2005, 10:05 AM
  5. recording macros
    By Pat in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 01-17-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1