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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,697
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,102,023
Messages
5,484,244
Members
407,435
Latest member
smurfkings247

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top