Computing.Net > Forums > Office Software > Automatic Date Macro

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Automatic Date Macro

Reply to Message Icon

Name: AdrianS
Date: September 9, 2008 at 05:05:03 Pacific
OS: XP
CPU/Ram: 1024mb
Product: Dell
Comment:

Im making a daily procedures list in excel but need to print it off a month in advance to go around the work place. I want the date at the top but dont want to type it in everytime then hit print. Is their a way similiar to a mail merge in Word where you can hit merge to printer and print a month in advance so the date comes out automatically?

thanks for anyone that can help



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: September 9, 2008 at 09:53:19 Pacific
Reply:

I'm not sure what you are trying to do.

Do you want a cell that will always show a date that is one month from the current date?

Look up EDATE() in Excel help.

=EDATE(TODAY(),1)


0

Response Number 2
Name: jon_k
Date: September 12, 2008 at 06:57:41 Pacific
Reply:

Yes you can do this with a macro.

You'll have to change the sheet name (anywhere it says "Sheet1"), and the range (anywhere it says "A1") where you have the date inputted.

Also I don't know if you need it or not, but I've set this to only print out weekdays (Mon-Fri) assuming you're using the standard 1900 windows date system. If you don't want it to do this (i.e. you want a printout for every day, including Saturdays and Sundays), you need to remove the lines I've put 'OPTIONALLY REMOVE at the end of.

To enter a macro, you need to press ALT-F11 in your spreadsheet, which brings up the VBA editor. Then go to Insert/Module and copy paste the code below. To run the macro, from a spreadsheet press ALT-F8, highlight "plusdate" and click "Run".


Sub plusdate()

Sheet1.PrintOut

For i = 1 To 31

Worksheets("Sheet1").Range("A1").Formula = Worksheets("Sheet1").Range("A1").Value + 1

If Worksheets("Sheet1").Cells(1, 1).Value Mod 7 > 1 Then 'OPTIONALLY REMOVE

Worksheets("Sheet1").PrintOut

End If 'OPTIONALLY REMOVE

Next i

End Sub


0

Response Number 3
Name: jon_k
Date: September 12, 2008 at 07:00:23 Pacific
Reply:

oops you need to change the bit that says Cells(1,1) to Range("A1") as well. Full code:


Sub plusdate()

Sheet1.PrintOut

For i = 1 To 31

Worksheets("Sheet1").Range("A1").Formula = Worksheets("Sheet1").Range("A1").Value + 1

If Worksheets("Sheet1").Range("A1").Value Mod 7 > 1 Then 'OPTIONALLY REMOVE

Worksheets("Sheet1").PrintOut

End If 'OPTIONALLY REMOVE

Next i

End Sub


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Automatic Date Macro

Automatic Date Feature in Excel www.computing.net/answers/office/automatic-date-feature-in-excel/7743.html

Macro - Word 95 to 2003 www.computing.net/answers/office/macro-word-95-to-2003/6280.html

In excel automatically Sorting a row by date www.computing.net/answers/office/in-excel-automatically-sorting-a-row-by-date/9133.html