Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default OnTime Challenge

I would like to run a macro using the ontime method that would run the macro
every 30 minutes. The spin is that I need the macro to run not when the run
button is pressed, but rather wait until the half hour (top and bottom of the
hour) with a delay of 10 min past that half.
Example:
Current time: 3:52 PM
Start the macro
The macro will wait until 4:00 PM
The macro will delay the run until cell ("A3") IE. 10mins
Macro runs at 4:10 PM

I would appreciate any help with this problem!


--
EW - Analyst
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default OnTime Challenge

In the macro fired when the button is clicked, schedule it to run on the next
half hour.

Then in the macro that runs, schedule the next running of the macro.

See Chip Pearson's site for an example
http://www.cpearson.com/excel/ontime.htm
--
Regards,
Tom Ogilvy


"ewagz" wrote:

I would like to run a macro using the ontime method that would run the macro
every 30 minutes. The spin is that I need the macro to run not when the run
button is pressed, but rather wait until the half hour (top and bottom of the
hour) with a delay of 10 min past that half.
Example:
Current time: 3:52 PM
Start the macro
The macro will wait until 4:00 PM
The macro will delay the run until cell ("A3") IE. 10mins
Macro runs at 4:10 PM

I would appreciate any help with this problem!


--
EW - Analyst

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default OnTime Challenge

Sorry,
How do I make a macro run on the next half hour?
--
EW - Analyst


"Tom Ogilvy" wrote:

In the macro fired when the button is clicked, schedule it to run on the next
half hour.

Then in the macro that runs, schedule the next running of the macro.

See Chip Pearson's site for an example
http://www.cpearson.com/excel/ontime.htm
--
Regards,
Tom Ogilvy


"ewagz" wrote:

I would like to run a macro using the ontime method that would run the macro
every 30 minutes. The spin is that I need the macro to run not when the run
button is pressed, but rather wait until the half hour (top and bottom of the
hour) with a delay of 10 min past that half.
Example:
Current time: 3:52 PM
Start the macro
The macro will wait until 4:00 PM
The macro will delay the run until cell ("A3") IE. 10mins
Macro runs at 4:10 PM

I would appreciate any help with this problem!


--
EW - Analyst

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default OnTime Challenge

One straight forward way:

Public Function NextHalf()
hr = Hour(Now)
mn = Minute(Now)
If mn = 30 Or mn = 0 Then
NextHalf = Now
ElseIf mn < 30 Then
NextHalf = Date + TimeSerial(hr, 30, 0)
Else
NextHalf = Date + TimeSerial(hr + 1, 0, 0)
End If
End Function


--
Regards,
Tom Ogilvy


"ewagz" wrote:

Sorry,
How do I make a macro run on the next half hour?
--
EW - Analyst


"Tom Ogilvy" wrote:

In the macro fired when the button is clicked, schedule it to run on the next
half hour.

Then in the macro that runs, schedule the next running of the macro.

See Chip Pearson's site for an example
http://www.cpearson.com/excel/ontime.htm
--
Regards,
Tom Ogilvy


"ewagz" wrote:

I would like to run a macro using the ontime method that would run the macro
every 30 minutes. The spin is that I need the macro to run not when the run
button is pressed, but rather wait until the half hour (top and bottom of the
hour) with a delay of 10 min past that half.
Example:
Current time: 3:52 PM
Start the macro
The macro will wait until 4:00 PM
The macro will delay the run until cell ("A3") IE. 10mins
Macro runs at 4:10 PM

I would appreciate any help with this problem!


--
EW - Analyst

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default OnTime Challenge

Thanks for the help, that should do it!
--
EW - Analyst


"Tom Ogilvy" wrote:

One straight forward way:

Public Function NextHalf()
hr = Hour(Now)
mn = Minute(Now)
If mn = 30 Or mn = 0 Then
NextHalf = Now
ElseIf mn < 30 Then
NextHalf = Date + TimeSerial(hr, 30, 0)
Else
NextHalf = Date + TimeSerial(hr + 1, 0, 0)
End If
End Function


--
Regards,
Tom Ogilvy


"ewagz" wrote:

Sorry,
How do I make a macro run on the next half hour?
--
EW - Analyst


"Tom Ogilvy" wrote:

In the macro fired when the button is clicked, schedule it to run on the next
half hour.

Then in the macro that runs, schedule the next running of the macro.

See Chip Pearson's site for an example
http://www.cpearson.com/excel/ontime.htm
--
Regards,
Tom Ogilvy


"ewagz" wrote:

I would like to run a macro using the ontime method that would run the macro
every 30 minutes. The spin is that I need the macro to run not when the run
button is pressed, but rather wait until the half hour (top and bottom of the
hour) with a delay of 10 min past that half.
Example:
Current time: 3:52 PM
Start the macro
The macro will wait until 4:00 PM
The macro will delay the run until cell ("A3") IE. 10mins
Macro runs at 4:10 PM

I would appreciate any help with this problem!


--
EW - Analyst

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
Find %ontime & SUMIF ontime ie: find matching sets within Range... Chris T-M Excel Worksheet Functions 3 October 10th 08 08:14 PM
OnTime VB [email protected] Excel Discussion (Misc queries) 5 May 17th 06 10:53 PM
OnTime VB [email protected] Excel Worksheet Functions 2 May 16th 06 08:43 PM
OnTime jimmike1 Excel Programming 2 February 2nd 06 04:31 PM
OnTime...Please Help Michael_I Excel Programming 9 May 24th 04 07:56 PM


All times are GMT +1. The time now is 09:38 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"