VBA/MACRO Date Update and Print out

durwoodghib

New Member
Joined
Apr 5, 2018
Messages
4
Good Day,
I have a simple weekly time sheet that currently I have to change the date each time and print, change the date, then print, until I have enough copies to last a while. I am unable to attach the file at this time, However, cell B7 would be the only date(cell) I need to change.

What I would like to to is have a Sub Program run where I could enter the date I want to start with, how many copies I would like, and it would place the date, print a copy, add 7(days) to the date, print again, ect. until I have reach the number of copies.

Can someone please help me get going in the right direction?

Thanks,
Durwood
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,540
Office Version
2010
Platform
Windows
This should get you started.

Code:
Sub DATE_PRINT()

CONST copies_to_print = [COLOR=#ff0000]'enter the number of copies here[/COLOR]
Dim begin_date As Date
Dim n As Integer

begin_date = [COLOR=#ff0000]'enter the beginning date here[/COLOR]

For n = 1 To copies_to_print Step 1

ThisWorkbook.Sheets("Sheet1").Range("B7").Value = begin_date
ThisWorkbook.Sheets("Sheet1").PrintOut COPIES:=1

begin_date = begin_date + 7
Next

End Sub
 

durwoodghib

New Member
Joined
Apr 5, 2018
Messages
4
I want to thank you for the response. I have not had much time to try this as of yet. Hope to soon.
 

durwoodghib

New Member
Joined
Apr 5, 2018
Messages
4
Good Day,

So work has been crazy and this has been a back burner job. However, today I utilized the code given and it worked beautifully. Thank you YKY for the help.
 

Watch MrExcel Video

Forum statistics

Threads
1,096,459
Messages
5,450,577
Members
405,619
Latest member
mjh237

This Week's Hot Topics

Top