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

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Automatic Date Macro

Reply to Message Icon

Original Message
Name: AdrianS
Date: September 9, 2008 at 05:05:03 Pacific
Subject: Automatic Date Macro
OS: XP
CPU/Ram: 1024mb
Manufacturer/Model: 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


Report Offensive Message For Removal


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)


Report Offensive Follow Up For Removal

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


Report Offensive Follow Up For Removal

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


Report Offensive Follow Up For Removal







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



Results for: Automatic Date Macro

Automatic Date Feature in Excel
    Summary: In an excel file I have a list of names and want people to enter comments for the latest status. Is there a way for excel to calculate that date the comment field was last updated each time? So today ...
www.computing.net/answers/office/automatic-date-feature-in-excel/7743.html

Excel and Macros - HELP!
    Summary: Hi shaamil Usually I use follofing code Dim olApp as Outlook.Application Dim msg as Outlook.MailItem Set olApp = CreateObject("Outlook.Application") Set msg = olApp.CreateItem("Outlook.MailItem") With...
www.computing.net/answers/office/excel-and-macros-help/1999.html

Macro - Word 95 to 2003
    Summary: Hi I have just installed 5 new client PCs for a customer. It is a workgroup and the clients are running XP Home. They originally had all Windows 95 (!!) machines with an XP Home box for a file server ...
www.computing.net/answers/office/macro-word-95-to-2003/6280.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes Today.
Discuss in The Lounge
Poll History






Data Recovery Software