ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I set this up (https://www.excelbanter.com/excel-programming/429343-how-do-i-set-up.html)

Ayo

How do I set this up
 
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


Mike H

How do I set this up
 
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
"Ayo" wrote:

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


Don Guillett

How do I set this up
 
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.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ayo" wrote in message
...
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



Don Guillett

How do I set this up
 
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.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ayo" wrote in message
...
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



Ayo

How do I set this up
 
Thanks Mike.
I will try this. Should Work fine.

"Mike H" wrote:

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
"Ayo" wrote:

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



All times are GMT +1. The time now is 04:39 PM.

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