+ Reply to Thread
Results 1 to 11 of 11

Pause Code to Calculate

  1. #1
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Pause Code to Calculate

    Is it possible to pause the VBA code to give Excel time to calculate before proceeding? What's the VBA statement?

    I read about a wait time function but that pauses the entire application and would not allow for calculations.

    Thanks,

    D
    Last edited by dreicer_Jarr; 02-23-2011 at 11:54 PM.
    ______________________________________
    "Vision without Execution is a Hallucination"
    Edison

  2. #2
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    Let me know if I can clarify the issue. ANY help would be appreciated.

    Thanks,

    D

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Pause Code to Calculate

    What does the code look like?

  4. #4
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    I will post when I get to my second PC (in an hour or so).

  5. #5
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    Code below, but note that the goal is to start and stop on the data hub page. The ranges SumR and SumT are on two separate tabs (this can't be changed unfortunatly). Also, G1 changes to 1, 2 or 3 based on the user selecting a drop-down box...the box is linked to cell G1. THANKS!

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    I would greatly appreciate some help if anyone is willing?

    Thanks,

    D

  7. #7
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Pause Code to Calculate

    hi,

    I'm not sure what you need, does your use of "Calculate" not work?

    Here's a modified version of your code, with a few extra comments...
    Please Login or Register  to view this content.

    hth
    Rob
    Last edited by broro183; 02-23-2011 at 07:57 PM. Reason: spotted two typo's
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  8. #8
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    That code did not work but thanks very much for trying. I fixed the problem using the following code, but frankly, I can't tell the difference -- it seems like your more efficient code should have worked. How can I write what is below more efficiently but so it does the exact same thing? (Note: G1 is on the data hub sheet)

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Pause Code to Calculate

    hmmm... interesting!

    It works for me what doesn't work for you?
    Does it error, or just give unexpected results?
    Are you running the code over sheets in the same workbook as the code is stored in (ie "with Thisworkbook")?
    Do you have more than one of each of the Named Ranges in the file you are working on (ie on different sheets but still called "SumR" or "SumT")?

    Do you know how to press [F8] to go through the code a line at a time?
    (place the cursor on a line within the macro first)
    EDIT: then, while you are stepping through the macro move the mouse cursor over each of the lines while they are highlighted yellow & see what values are revealed. Is it what you expect?
    /END EDIT

    What happens if you...
    Please Login or Register  to view this content.
    Rob
    Last edited by broro183; 02-23-2011 at 09:41 PM.

  10. #10
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Re: Pause Code to Calculate

    I had more than one range named on different sheets. I must have done that by mistake somehow. Thanks for all of the help. Another issue resolved! I really like this Web forum.

  11. #11
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Pause Code to Calculate

    Beauty!
    I'm pleased I could help, thanks for the feedback, adding to my rep' and marking the thread as Solved

    btw, Chip's website has a useful explanation of "Global-Scope And Sheet-Scope Names" on this page: http://www.cpearson.com/excel/DefinedNames.aspx
    Plus here's a free & very useful addin for working with named ranges: http://www.jkp-ads.com/officemarketplacenm-en.asp

    Rob

+ 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