Run Macro if
Put your call to the procedure inside a conditional statement
** template code
If date1 < date2 then
call KeepRecords
Else
do something else?
End
Specific code might look like.....
Sub Master()
If sheets("MTD").Range("A1") < sheets("Reports").Range("A2") then
Call KeepRecords
Else
MsgBox "Records already updated"
End If
End Sub
--
Cheers
Nigel
"sd" wrote in message
oups.com...
I have a macro that I only want to run if it has not run yet. I want to
check to see if the date in cell 1 is the same as the date in another
sheet.
Sub KeepRecords()
'Check sheet MTD (1, 0) If value is same date do no run.
Dim LastRow As Object
Set LastRow = Sheets("MTD").Range("A65536").End(xlUp)
With LastRow
.Offset(1, 0) = Sheets("Report").Range("O1")
.Offset(1, 1) = Sheets("Report").Range("C4")
.Offset(1, 2) = Sheets("Report").Range("C5")
.Offset(1, 3) = Sheets("Report").Range("C6")
.Offset(1, 4) = Sheets("Report").Range("G4")
.Offset(1, 5) = Sheets("Report").Range("G5")
.Offset(1, 6) = Sheets("Report").Range("G6")
.Offset(1, 7) = Sheets("Report").Range("G7")
.Offset(1, 8) = Sheets("Report").Range("I6")
End With
End Sub
|