+ Reply to Thread
Results 1 to 4 of 4

Macro to run multiple queries

  1. #1
    Registered User
    Join Date
    01-25-2009
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro to run multiple queries

    Hi,

    I have a spreadsheet that has individual queries that are each on a separate worksheet. Each worksheet has the following code belowto automatically connect and run the query and return results to the worksheet. Since there are over 60 queries, I would like to be able to just click one button to run all queries. They have to run individually, so I am unsure how to write anything that would tell it to run the next query when the previous one finishes.

    Any help would be greatly appreciated, thanks

    Please Login or Register  to view this content.
    Last edited by asreid2527; 06-07-2009 at 11:35 PM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Macro to run multiple queries

    Please take a couple of minutes and read ALL theForum Rules then wrap your VBA code (Rule 3)
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    01-25-2009
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to run multiple queries

    wrapped vba code. Is anyone able to advise where to update specific worksheet names in this code so I can copy it mulitple times. Also is there something I need to add so it runs each query only when prior one completes?
    Thanks

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Macro to run multiple queries

    Suggest you try this on a backup copy of your workbook

    Instead of having the same macro 60 times I suggest 1 macro that loops through each worksheet & calls the 1 macro that is re-written to work with each sheet


    Please Login or Register  to view this content.

    It is possibel that the code you posted will work correctly if you paste a copy in a normal module & delete all others copies of the macro

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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