+ Reply to Thread
Results 1 to 3 of 3

how to add delay after a sub, then execute new sub?

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    how to add delay after a sub, then execute new sub?

    I have this macro:

    Please Login or Register  to view this content.
    I'd like to add a 2 second delay after the above code is executed, then add the following code:

    Please Login or Register  to view this content.
    How could this be done? Thanks

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: how to add delay after a sub, then execute new sub?

    Why do you need a delay?

    Generally you can use this to add a delay https://msdn.microsoft.com/en-us/vba...t-method-excel

    Its honestly not something you should do often as its a last resort. VBA is aware of its own process, so code doesnt generally execute until the prior code has completed.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  3. #3
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: how to add delay after a sub, then execute new sub?

    Thank you. The purpose of the delay is to prevent Excel from hanging. If the first sub runs then Excel "works" a few seconds, completing several data queries.

    I don't want to do a refresh until the data queries have run.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to execute formula in batches (or with delay)
    By dechesne in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-08-2016, 07:59 AM
  2. Execute a macro in a closed workbook, or open and execute without the user noticing
    By cearaujo123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2015, 06:44 PM
  3. code to execute a keyboard shortcut or to execute a toolbar button
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2015, 12:16 PM
  4. Vba: Time Delay to execute - Input from Cell Value
    By vidyuthrajesh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2014, 10:24 AM
  5. [SOLVED] Change From Execute on Selections to Execute On All
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2014, 09:23 AM
  6. IF cell=error execute sub 1 if value execute sub 2... possible?
    By CDNcameron in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2013, 05:28 PM
  7. Delay
    By shapper in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2008, 08:41 PM

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