#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Date Marco

Dear Expert,
Have asked for time marco before.
Just wonder how to write the date marco in VB please ?
Say want to run on 5 May 9:00 AM please ?
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Marco


Do you want to display a date or run some code on a date?

Elton Law;331987 Wrote:
Dear Expert,
Have asked for time marco before.
Just wonder how to write the date marco in VB please ?
Say want to run on 5 May 9:00 AM please ?
Thanks



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=92790

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Date Marco

Using these two procedures, Start will initiate the run when it is 9am, in
my_date if the date is 5th May 09 then code will run, else Start is re-run
to wait for 9am next day.

Sub Start()
Application.OnTime TimeValue("09:00:00"), "my_date"
End Sub

Sub my_date()
If Date < DateSerial(2009, 5, 5) Then
Start
Exit Sub
End If

'your code to run at 9am on 5/5/09

End Sub

--

Regards,
Nigel




"Elton Law" wrote in message
...
Dear Expert,
Have asked for time marco before.
Just wonder how to write the date marco in VB please ?
Say want to run on 5 May 9:00 AM please ?
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Date Marco

First, I would read Chip Pearson's notes:
http://www.cpearson.com/excel/OnTime.aspx

And second,

Application.OnTime EarliestTime:=dateserial(2009,5,9)+timeserial(9,0, 0), _
Procedu=...., Schedule:=True

Remember that if you close excel, then this scheduled macro won't run.


Elton Law wrote:

Dear Expert,
Have asked for time marco before.
Just wonder how to write the date marco in VB please ?
Say want to run on 5 May 9:00 AM please ?
Thanks


--

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
Help with this marco JBoyer Excel Programming 4 August 2nd 08 04:23 AM
Help with marco Gary Keramidas Excel Programming 1 December 2nd 06 05:17 AM
I need some help with a Marco xgunda420x Excel Discussion (Misc queries) 2 August 2nd 05 01:43 PM
Filling a cell with today's date (Datestamp completed marco) Diane Alsing Excel Programming 7 February 14th 05 10:54 AM
Can it be done by marco? kaon[_5_] Excel Programming 1 June 28th 04 10:56 AM


All times are GMT +1. The time now is 08:54 PM.

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"