View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default Start Macro Daily task

How about having the macro start everytime the workbook was opened, but then
check to see if it's already run:

Option Explicit
Sub auto_open()

Dim LogWks As Worksheet
Dim res As Variant

Set LogWks = Worksheets("Log")

res = Application.Match(CLng(Date), LogWks.Range("a:a"), 0)

If IsNumeric(res) Then
'already run, do nothing
Else
With LogWks
.Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Value = Date
.Parent.Save
End With
End If

'rest of stuff to do

'thisworkbook.Close savechanges:=false 'maybe

End Sub



GoBucks wrote:

Is there a way to start a Macro with a daily task,( i.e. a switch of some
kind.)
but not have the macro start everytime the sheet opens. I am trying to
avoid using two different workbooks to accomplish this.
--
Jeff


--

Dave Peterson