ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Autorun macro by date (https://www.excelbanter.com/excel-discussion-misc-queries/24006-autorun-macro-date.html)

Steve

Autorun macro by date
 
This is a repost as my one this morning doesn't appear to have saved,
so ap;ologies if I end up raising the same question twice.

I have a macro called 'Update_Me'which I would like to run
automatically on the first of each month (when excel is opened,
obviously). How do I go about this?

Thanks in advance

Steve


Jason Morin

Try something like:

Sub Workbook_Open()
Dim dToday As Date
dToday = Now
If Day(dToday) = 1 Then
'rest of code here
End If
End Sub

---
Place this in ThisWorkbook module.

HTH
Jason
Atlanta, GA


"Steve" wrote:

This is a repost as my one this morning doesn't appear to have saved,
so ap;ologies if I end up raising the same question twice.

I have a macro called 'Update_Me'which I would like to run
automatically on the first of each month (when excel is opened,
obviously). How do I go about this?

Thanks in advance

Steve



Steve

Hi Jason

I tested this and it worked perfectly. Thank you.

Steve



All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com