Incrementing the date

G

Guest

I print out a register, 1 for each day of the month is there anyway of
incrementing the date for each one, so i don't have to change the date each
time i print it out.
 
D

Dave Peterson

And do you put the date in a cell (what cell)?

Or do you put it in the header or footer?

I'm guessing that you want to preprint the forms for a month (like on the first
of the month).

If that's true, you could create a macro that would cycle through the dates and
print the worksheet for each date.

But the details of the macro depend on what you really want.
 
G

Guest

I would prefer to have the date in a header, but in a cell at the top of the
page would do.
Yes i would like to print the whole months off all in one go.
 
D

Dave Peterson

I recorded a macro to get the correct syntax for the header section that I
wanted. I used .leftheader in this code:

Option Explicit
Sub PrintLots()

Dim wks As Worksheet
Dim iDate As Date
Dim StartDate As Date

Set wks = Worksheets("Sheet1")

'first of the month. I used October 1, 2007
StartDate = DateSerial(2007, 10, 1)

'from the start date to the last day of the month
For iDate = StartDate To DateSerial(Year(StartDate), _
Month(StartDate) + 1, 0)

With wks.PageSetup
.LeftHeader = "whateveryouwanthere " & Format(iDate, "mm/dd/yyyy")
End With

wks.PrintOut preview:=True

Next iDate
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
M

mills08

Thanks Dave that Macro did work, sorry for the late reply I've only just got
round to trying it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top