close

I have a full-page form that we use in paper form. It is date
dependent and instead of having to manually enter in the date in a cell
at the top of the form for each day, then click print, I would love to
get it to just do it for me.

Is there a way to make it so that if I print 30 pages it will give me a
different date for each page?

Thanks in advance!You want to print out a month's supply of the form?

You could use a little macro:

Option Explicit
Sub testme()
Dim myDateCell As Range
Dim iCtr As Long
Dim wks As Worksheet

Set wks = Worksheets(quot;Sheet1quot;)

With wks
Set myDateCell = .Range(quot;a1quot;)
For iCtr = 0 To 30
myDateCell.Value = myDateCell.Value iCtr
.PrintOut preview:=True
Next iCtr
End With

End Sub

You could even put the first date in the cell and have it go to the end of that
month and skip the weekends:

Option Explicit
Sub testme2()
Dim myDateCell As Range
Dim myDate As Date
Dim iCtr As Long
Dim wks As Worksheet

Set wks = Worksheets(quot;Sheet1quot;)

With wks
Set myDateCell = .Range(quot;a1quot;)
myDate = myDateCell.Value
For iCtr = myDate To DateSerial(Year(myDate), Month(myDate) 1, 0)
If Weekday(iCtr, vbMonday) gt; 5 Then
'weekend, do nothing
Else
myDateCell.Value = iCtr
.PrintOut preview:=True
End If
Next iCtr
End With

End Sub

I did use Preview:=true for testing.

If you're new to macros, you may want to read David McRitchie's intro at:
www.mvps.org/dmcritchie/excel/getstarted.htm
wrote:
gt;
gt; I have a full-page form that we use in paper form. It is date
gt; dependent and instead of having to manually enter in the date in a cell
gt; at the top of the form for each day, then click print, I would love to
gt; get it to just do it for me.
gt;
gt; Is there a way to make it so that if I print 30 pages it will give me a
gt; different date for each page?
gt;
gt; Thanks in advance!

--

Dave Peterson

Thanks! Will give it a shot.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()