+ Reply to Thread
Results 1 to 3 of 3

Run Macro every 10 seconds

  1. #1
    Registered User
    Join Date
    04-10-2013
    Location
    Chapel Hill, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Run Macro every 10 seconds

    Hi,

    I have written a macro which queries something from the internet. The response takes about 4 seconds. So, I would like to run that macro every 10 seconds. How can I do this?
    The macro name is "asdf" and the shortcut is ctrl+i.

    Please help me out.

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Run Macro every 10 seconds

    Look up using the OnTime method.

    In the macro itself you would use the OnTime method at the end to set a timer to run itself again in 10 seconds. Right before that line of code, put some sort of "test" that allows the macro to know when it's time to abort and not run that last line of code to set the timer again.

    Also, create a macro to turn off the timer. Searching for OnTime should reveal all of these methods and millions of examples.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-10-2013
    Location
    Chapel Hill, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Run Macro every 10 seconds

    JBeaucaire,
    Thanks a lot for pointing me to the right place. I learnt a lot from this.

    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1