I need some code to run a macro just once a day, it doesn't matter how many times you open the file where is the macro.
If the file is not opened one day it doesn't have to run the macro, just do it when it is opened.
It has to have a ¨internal" variable or something like that, I guess, that keeps the info whether the macro has alredy run or not this day.
Besides, to make it more difficult, I suppose, the macro open a different Workbook each day.
Any thoughts.
I am novice, so forgive me if that is so clear. Thanks in advance.
EDITED: I found some code here:
that seems to do it but you have to create an extra sheet, I would like to dont do that.
Here is the code:
Private Sub Workbook_Open()
Dim rngFindTodaysDate As Range
With ThisWorkbook.Worksheets("Status")
On Error GoTo X
Set rngFindTodaysDate = .Range("A1").End(xlDown).Find(Date)
If rngFindTodaysDate Is Nothing Then
.Range("A" & .Range("A" & Rows.Count).End(xlUp).Row + 1) = Date
''''' your Code Here
End If
End With
X:
End Sub