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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,710
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.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,078
Messages
5,509,135
Members
408,712
Latest member
nehasharma

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top