+ Reply to Thread
Results 1 to 3 of 3

Print same sheet, increment date, do it for a month

  1. #1
    Registered User
    Join Date
    08-25-2005
    Location
    NSW, Australia
    Posts
    7

    Print same sheet, increment date, do it for a month

    Okay, I have a sheet that I print out a whole month at a time. I want it to print the Day, Date, Month, Year on each sheet for the month, in other words increment the date for each sheet printed.
    I found a nice piece of code in another post. It allows me to type in the month at h1, and the year at h2, and then the macro prints out the sheets for that month.
    But it prints the date in the footer. I would like the date printed at B5. How do I do that?

    Sub dateinfooter()
    Dim CopiesCount As Long
    Dim CopieNumber As Integer
    Dim N As Integer
    Dim ws As Worksheet
    Dim strName As String
    Dim datepick As String
    N = 1

    strName = Range("h1").Value
    datepick = Range("h2").Value

    Select Case strName

    Case "January", "March", "May", "June", "July", "August", "October", "December"

    CopiesCount = 31

    Case "April", "June", "September", "November"
    CopiesCount = 30

    Case "February 28"

    CopiesCount = 28
    Case "February 29"
    CopiesCount = 29
    Case Else

    Exit Sub

    End Select



    For CopieNumber = 1 To CopiesCount
    With ActiveSheet

    .PageSetup.RightFooter = "&""Arial,Bold""&16DATE : " & strName & " " & N & " " & datepick

    '.PrintOut preview:=True 'JUST FOR TESTING
    .PrintOut 'Print the sheet

    End With
    N = N + 1
    Next CopieNumber

    'ActiveSheet.PageSetup.RightFooter = ""

    End Sub

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Print same sheet, increment date, do it for a month

    See if this does what you want.
    Please Login or Register  to view this content.
    This assumes the date in H2 corresponds to the month in H1.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    08-25-2005
    Location
    NSW, Australia
    Posts
    7
    Quote Originally Posted by JLGWhiz View Post
    See if this does what you want.
    Please Login or Register  to view this content.
    This assumes the date in H2 corresponds to the month in H1.
    Thanks Whiz I will give that a go later

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Increment from first date till end date of given Month
    By acsishere in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-28-2018, 12:25 PM
  2. [SOLVED] Copy sheet, rename with name and month increment
    By julhs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-20-2016, 12:13 PM
  3. Date Increment by one month
    By cat57 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-16-2013, 03:14 PM
  4. Replies: 2
    Last Post: 03-17-2013, 03:57 AM
  5. Replies: 1
    Last Post: 12-15-2011, 05:32 AM
  6. Print Sheet, Increment Cell Formula, Repeat.
    By K_Dub in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2011, 11:46 AM
  7. Increment month for Date type
    By gtmeloney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2009, 02:52 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