View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Incrementing the date

You wish to print 30 copies in one print job with the date changing in each
copy?

Here is a revised version of code from Ron de Bruin's site

Sub PrintCopies_ActiveSheet_1()
Dim CopiesCount As Long
Dim CopieNumber As Long
Dim startdate As Date

CopiesCount = Application.InputBox("How many copies do you want", Type:=1)
startdate = InputBox("enter a starting date")

For CopieNumber = 1 To CopiesCount
With ActiveSheet
' This example print the number in cell A1
'.Range("A1").Value = Format(startdate - 1 + _
CopieNumber, "dddd mmmm dd ,yyyy")
'If you want the number in the header use this line
.PageSetup.CenterHeader = Format(startdate - 1 + _
CopieNumber, "dddd mmmm dd ,yyyy")
'Print the sheet
.PrintOut preview:=True 'for testing
' .PrintOut 'for printing
End With
Next CopieNumber
End Sub

No error-checking.

For original code from Ron see http://www.rondebruin.nl/print.htm#same


Gord Dibben MS Excel MVP

On Mon, 29 Oct 2007 09:11:03 -0700, mills08
wrote:

I'm trying to print a daily register, with the date on the top, is it
possible to increment the date for every day of the month to save having to
change the date 30 odd times? I would like to print them off all in one go
without having to change the date several times.