![]() |
Macro to run on Mon and Tues
I'd like this macro to run only on Mon and Tues. This is what I wrote:
Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? |
Macro to run on Mon and Tues
Sub Auto_Open()
If Weekday(Date) = 2 _ Or weekday(date) = 3 Then Call CreateProjStatMenubar End If End Sub salgud wrote: I'd like this macro to run only on Mon and Tues. This is what I wrote: Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? -- Dave Peterson |
Macro to run on Mon and Tues
Try If Weekday(Now) = 2 Or Weekday(Now) = 3 Then ' your code here End If Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 6 Feb 2009 12:52:24 -0700, salgud wrote: I'd like this macro to run only on Mon and Tues. This is what I wrote: Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? |
Macro to run on Mon and Tues
Try this...
Sub Auto_Open() If Weekday(Date, vbMonday) < 3 Then Call CreateProjStatMenubar End Sub -- Rick (MVP - Excel) "salgud" wrote in message .. . I'd like this macro to run only on Mon and Tues. This is what I wrote: Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? |
Macro to run on Mon and Tues
It tests for if any of those is true:
Weekday(Now()) = 2 or 3 ! Test this: Sub Test() If 3 Then MsgBox "ok" End If End Sub ... runs every day. Switch to If Weekday(Now()) = 2 Or Weekday(Now()) = 3 Then HTH. Best wishes Harald "salgud" wrote in message .. . I'd like this macro to run only on Mon and Tues. This is what I wrote: Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? |
Macro to run on Mon and Tues
On Fri, 6 Feb 2009 12:52:24 -0700, salgud wrote:
I'd like this macro to run only on Mon and Tues. This is what I wrote: Sub Auto_Open() If Weekday(Now()) = 2 Or 3 Then Call CreateProjStatMenubar End If End Sub But the macro runs every day. Any suggestions? Thanks to all! |
All times are GMT +1. The time now is 05:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com