One A day
Thanks for the reply
The code is run manually, but we are having trouble with some operators
running it twice. As I said when the macro runs it changes the date in A2 to
yesterdays date and that is the check I was thinking of using to determine if
it had been already run. I guess a message box would be good too so I can
point out the error to the operator.
Thanks!
"K Dales" wrote:
Do you mean "prevent it from being run more than once a day?" Test the value
before the code changes it:
Sub RunMeOnceADay()
If Worksheeets("Sheet1").Range("A2").Value < Date()-1 Then
... code to run goes here
Worksheeets("Sheet1").Range("A2").Value = Date()-1 ' sets the date
in A2
End If
End Sub
If you really mean "once a day", when do you actually want/need the code to
run?
--
- K Dales
"Sandy" wrote:
Hello Group
What should I add to my code to prevent it from being run once a day? Once
updated yesterdays date is in A2 of sheet1.
Thanks!
|