+ Reply to Thread
Results 1 to 12 of 12

Long Macro Running too Fast actually Pastes "#GETTING_DATA"

  1. #1
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    I've got a weird problem. I'm running ActiveWorkbook.RefreshAll to get data from SQL via PowerQuery, and then I have a long macro to do some refreshing within the workbook.

    When I run them separately, everything is great. But I run into trouble with I try to run one after the other.

    Specifically, there's one data set that I refresh and then copy paste special, but the macro is running slow and so it's actually pasting "#GETTING_DATA"

    I've tried Application.Wait in a few different places. I've also tried enabling screen updating. And nothing works.

    Someone suggested disabling background refresh in the connections properties. Mine is grayed out, but it seems to already be disabled.

    So...any ideas?

    And I hope that makes sense.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Hi xladept, thanks for the reply. I usually try to attach sample workbooks, but there's just no way with this one because of the PowerQuery connection.

    Someone suggested I try DoEvents, but that didn't change anything. I also tried to do the refresh on Workbook_Open, and using a message box after ActiveWorkbook.RefreshAll to trigger the other macros, and still no change.

    I'm about to admit defeat. Any other ideas?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Well then, how about posting the code? (be sure to use code tags - just highlight the code and click on the #)

  5. #5
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Ok...this might not make a lot of sense without context, but here it is:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    Thanks for your help!! I hope that makes sense.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Does it work if you don't' use ActiveSheet.Paste?

    For example,
    Please Login or Register  to view this content.
    or, perhaps, just.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Try:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Norie, I got rid of all cutting and pasting until the final step. The code is cleaner, but it still doesn't work!

    BTW, the Refresh macro works perfectly on its own. It just has trouble with the last step when combined with RefreshAll.


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    xladept, I'm not sure what that is. Where would it go?

  10. #10
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    I have a working solution. Finally!

    Please Login or Register  to view this content.
    It delays the data refresh and then my second macro runs as it normally does.

    Thanks so much for your help, everyone!

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Glad you got it!

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    07-31-2019
    Location
    Vilnius
    MS-Off Ver
    Professional Plus 2016
    Posts
    2

    Re: Long Macro Running too Fast actually Pastes "#GETTING_DATA"

    Hello phelbin,

    Can't thank you enough for introducing me to
    Please Login or Register  to view this content.
    method. I would just like to add definition for this method from Microsoft's VBA reference so others be more confident:
    Runs all pending queries to OLEDB and OLAP data sources.

+ 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. [SOLVED] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. Macro to delete rows with "0" values in columns trouble, fast in a workbook slow in anothe
    By Bud Wilkinson in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 02-16-2016, 11:00 PM
  3. Same Macro "Slow and Fast on different accounts on same comp"
    By muzamilsumra in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2012, 09:09 AM
  4. How can i copy value from "HTMLText"(EMBED("Forms.HTML:Text","")),using Macro
    By andrewyang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2010, 12:47 AM
  5. Macro code too long: "Procedure too large" Error
    By nachousa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2010, 03:16 PM
  6. Replies: 1
    Last Post: 02-07-2010, 12:44 AM
  7. "Reference is not Valid" when calling fast fourier transform
    By JacksonRJones in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2006, 09:10 AM

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