Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Autorun a macro at preset times

I have a macro that draws data from a website and places in to several tables
which are then organised is different criteria. Instead of me manually
hitting the button with assigned macro, I want to have the macro run itself
every 10 minutes. How do I do this please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Autorun a macro at preset times

Darren,

have a look at ONTIME in Excel VBA help

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Darren" wrote:

I have a macro that draws data from a website and places in to several tables
which are then organised is different criteria. Instead of me manually
hitting the button with assigned macro, I want to have the macro run itself
every 10 minutes. How do I do this please?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Autorun a macro at preset times

You can use this line of code:

Sub YourSub()

' your code here

Application.OnTime Now + TimeValue("00:10:00"), "YourSub"

End Sub

I would also suggest you reading Chip Pearson's site about the OnTime Event.
Hope this helps! If so, let me know, click "YES" below.

http://www.cpearson.com/Excel/OnTime.aspx

--
Cheers,
Ryan


"Darren" wrote:

I have a macro that draws data from a website and places in to several tables
which are then organised is different criteria. Instead of me manually
hitting the button with assigned macro, I want to have the macro run itself
every 10 minutes. How do I do this please?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Autorun a macro at preset times

Hi Mike, I did as you suggested and this is what I come up with:
Sub Autorun()
'
' Autorun Macro
'

'
Application.OnTime Now + TimeValue("00:10:00"), "Refresh"
End Sub
Unfortunately it only repeats once. How to I make it repeat itself at the
stated time intervals i.e. every 10 minutes?

"Mike H" wrote:

Darren,

have a look at ONTIME in Excel VBA help

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Darren" wrote:

I have a macro that draws data from a website and places in to several tables
which are then organised is different criteria. Instead of me manually
hitting the button with assigned macro, I want to have the macro run itself
every 10 minutes. How do I do this please?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Autorun a macro at preset times

You are telling the OnTime Event to run a macro named "Refresh" you want to
re-run "Autorun". Try this line below or see my reply to your original post.
Hope this helps! If so, let me know click "YES" below.

Application.OnTime Now + TimeValue("00:10:00"), "Autorun"
--
Cheers,
Ryan


"Darren" wrote:

Hi Mike, I did as you suggested and this is what I come up with:
Sub Autorun()
'
' Autorun Macro
'

'
Application.OnTime Now + TimeValue("00:10:00"), "Refresh"
End Sub
Unfortunately it only repeats once. How to I make it repeat itself at the
stated time intervals i.e. every 10 minutes?

"Mike H" wrote:

Darren,

have a look at ONTIME in Excel VBA help

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Darren" wrote:

I have a macro that draws data from a website and places in to several tables
which are then organised is different criteria. Instead of me manually
hitting the button with assigned macro, I want to have the macro run itself
every 10 minutes. How do I do this please?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Autorun a macro at preset times

Thankyou.

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
Autorun macro does not autorun... ARbitOUR[_19_] Excel Programming 5 August 24th 09 02:18 PM
Autorun macro Josh Excel Discussion (Misc queries) 2 August 16th 09 02:19 PM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM
autorun a macro Reab Excel Programming 1 November 28th 03 09:42 PM


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