Results 1 to 2 of 2

Increment date to next day after each printed sheet copy [CODE FIX]

Threaded View

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    24

    Question Increment date to next day after each printed sheet copy [CODE FIX]

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _ 
    ByVal Target As Range, Cancel As Boolean) 
    Dim sDate, i 
    retryDate: 
    sDate = InputBox("Enter the starting date, or click 'OK'" & _ 
    " for the current date", "Start Date") 
    If sDate = "" Then 
    sDate = Date 
    ElseIf Not IsDate(sDate) Then 
    retryDate = MsgBox("Invalid date format", vbRetryCancel + vbCritical, "Retry?") 
    Select Case retry 
    Case Is = vbRetry 
    GoTo retryDate 
    Case Is = vbCancel 
    Target.Offset(0, 1).Select 
    Exit Sub 
    End Select 
    End If 
    retryNum: 
    numCopies = InputBox("Enter the number of signup " & _ 
    "sheets to print.", "Days to Print") 
    If numCopies = "" Then 
    Target.Offset(0, 1).Select 
    Exit Sub 
    ElseIf Not IsNumeric(numCopies) Then 
    retryNum = MsgBox("Invalid numeric format", vbRetryCancel + vbCritical, "Retry?") 
    Select Case retryNum 
    Case Is = vbRetry 
    GoTo retryNum 
    Case Is = vbCancel 
    Target.Offset(0, 1).Select 
    Exit Sub 
    End Select 
    End If 
    For i = 0 To numCopies - 1 
    ActiveSheet.Range("A1").Value = CDate(sDate) + i 
    ActiveSheet.PrintOut copies:=1 
    Next i 
    Target.Offset(0, 1).Select 
    End Sub
    Hello,

    Im trying to make a daily brief log to update the date after each printed page

    Ie If date is in cell A1 is Friday,June 13, 2014 and I ask for 3 copies to be printed then

    page 1 should read Friday June 13 2014 when printed
    Page 2 should read Saturday June 14 2014 when printed
    Page 3 should read Sunday June 15 2014 when printed and etc automatically adding the days

    I found the below code but it wouldn't work for me


    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
    ByVal Target As Range, Cancel As Boolean)
    Dim sDate, i
    retryDate:
    sDate = InputBox("Enter the starting date, or click 'OK'" & _
    " for the current date", "Start Date")
    If sDate = "" Then
    sDate = Date
    ElseIf Not IsDate(sDate) Then
    retryDate = MsgBox("Invalid date format", vbRetryCancel + vbCritical, "Retry?")
    Select Case retry
    Case Is = vbRetry
    GoTo retryDate
    Case Is = vbCancel
    Target.Offset(0, 1).Select
    Exit Sub
    End Select
    End If
    retryNum:
    numCopies = InputBox("Enter the number of signup " & _
    "sheets to print.", "Days to Print")
    If numCopies = "" Then
    Target.Offset(0, 1).Select
    Exit Sub
    ElseIf Not IsNumeric(numCopies) Then
    retryNum = MsgBox("Invalid numeric format", vbRetryCancel + vbCritical, "Retry?")
    Select Case retryNum
    Case Is = vbRetry
    GoTo retryNum
    Case Is = vbCancel
    Target.Offset(0, 1).Select
    Exit Sub
    End Select
    End If
    For i = 0 To numCopies - 1
    ActiveSheet.Range("A1").Value = CDate(sDate) + i
    ActiveSheet.PrintOut copies:=1
    Next i
    Target.Offset(0, 1).Select
    End Sub

    I uploaded a sample copy of the briefing log.

    Thanks for any help in advance.
    BRIEF LOG example.xls
    Last edited by gtaaccord; 06-13-2014 at 10:22 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Increment serial number for each printed page
    By hbasbay in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-01-2014, 11:55 PM
  2. Increment Date Based on Number of Pages Printed
    By kendrickfamily@go.com in forum Excel General
    Replies: 3
    Last Post: 12-14-2011, 08:04 PM
  3. Increment serial number for each printed page
    By Fungijus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-26-2011, 10:28 AM
  4. [SOLVED] Increment a number in a cell for each page printed
    By Steve Vincent in forum Excel General
    Replies: 6
    Last Post: 06-19-2006, 06:15 PM
  5. code for showing a sheet has been printed
    By Giselle in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-08-2006, 08:00 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