How do I set this up

  • Thread starter Thread starter Ayo
  • Start date Start date
A

Ayo

I want to setup a macro, in a file, that only run once on a specific day of
the week regardless of who first open the file. The macro needs to run only
once, every monday, the first time the file is open. Any subsequent opening
of the file after that, the macro should not run.
How do I go about setting this up? I just need someone to point me in a
generally direction and I should be able to take it from there.
Thanks
Ayo
 
Hi,

You could do this which checks if it's a Monday and if the Mondays date
isn't in sheet 1 A1 amd then calls tour macro. It prevents a second run by
writing the date to a1

Private Sub Workbook_Open()
If Weekday(Date) = 1 And Sheets("Sheet1").Range("A1").Value <> Date Then
Sheets("Sheet1").Range("A1").Value = Date
Call MyMacro
End If
End Sub


Mike
 
OK. In the thisworkbook module put in a workbook_open macro to run the macro
and put todays date somewhere. Have the macro check to see if the date is
later or not run.
 
Thanks Mike.
I will try this. Should Work fine.

Mike H said:
Hi,

You could do this which checks if it's a Monday and if the Mondays date
isn't in sheet 1 A1 amd then calls tour macro. It prevents a second run by
writing the date to a1

Private Sub Workbook_Open()
If Weekday(Date) = 1 And Sheets("Sheet1").Range("A1").Value <> Date Then
Sheets("Sheet1").Range("A1").Value = Date
Call MyMacro
End If
End Sub


Mike
 
Back
Top