MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Automating tasks based on date


Posted by Adam on July 05, 2000 9:57 AM

Is there any way to run a macro based on the date and time.
I am running monthly reports and i want a new sheet to be created if the date is the 30th of the month.
Any ideas
Thanks in advance.


Posted by Ryan on July 05, 0100 12:11 PM

Adam,

Use this qualifier:

If Format(Date,"dd") = 30 Then
Insert Code Here
End if
Hope this helps, let me know!
Ryan

Posted by adam on July 05, 0100 12:15 PM

I dont understand what is causing this to run.
What event is running this code.
How it only do it once a month\
thanks.


Posted by Ryan on July 05, 0100 7:30 PM

Adam,
When you put this code in the ThisWorkBook module, everytime you open the workbook, it will check to see if the day is 30, and if it is, then the code you tell it to run will run. If you still don't understand, you can send me your stuff and i'll take a look at it.

Ryan

Private Sub Workbook_Open()
If Format(Date,"dd") = 30 Then
Insert Code Here
End if
End Sub