Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
GoBucks
 
Posts: n/a
Default Start Macro Daily task

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
  #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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"