+ Reply to Thread
Results 1 to 5 of 5

"Out of Stack Space" error vba Excel 2010

  1. #1
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    "Out of Stack Space" error vba Excel 2010

    Please Login or Register  to view this content.
    It's giving me the error where I annotated it. Any ideas? Those formula are taken quite literally from my excel sheet exactly the same way (but converted to vba of course), but I wanted to run the for/next loop to increment varX which excel couldn't do on it's own so I turned it into code. Not sure why that line is giving error when it works perfectly fine in Excel using the same cells/formula . Btw, that's error 1004.
    Last edited by Taemex; 02-04-2014 at 03:37 AM.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: "Out of Stack Space" error vba Excel 2010

    Changing the cell is firing the Worksheet_Change event, which changes the cell which fires the Worksheet_Change event which changes the cell which fires... eventually you get dizzy and fall down - so does Windows.

    You need to disable the event firing at the start of the procedure
    Please Login or Register  to view this content.
    not forgetting to re-enable afterwards.

    As you are disabling event handling, it it critical you include an error handler to trap any potential errors, otherwise Excel will be unresponsive to any events after the error....

    Might suggest the following structure for your procedure.
    Please Login or Register  to view this content.
    Last edited by cytop; 02-04-2014 at 04:11 AM.

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: "Out of Stack Space" error vba Excel 2010

    I'm wondering if that might disable the rest of my code. I only listed part of it because, well, I didn't think the answer would have an effect on the first part of my code, but now I'm not so sure. Here is my code on that page in its entirety:

    Please Login or Register  to view this content.
    If I add in your suggestion, won't that disable the event triggering of the two Intersected cells?

    EDIT: I just tried it with your suggestions and the two bits of code before what my initial posting work fine, but the bit of code I put does not work now. It does not loop correctly and thus instead of continuing the If/Then until formulaX is greater than 1, it stops at 1. Thoughts?

    EDIT-2: I decided to make a button instead for this formula that the user can press to eliminate all issues. But it still does not For counterX correctly. I thought if I had put from 1 to x, and x incremented within the code until certain conditions were met, that the loop would continue until x became true. This does not seem to be the case. For/Next seem to only loop a set amount of times based on what x was when the loop first started. This is not like how vb was back in the 80's. How can I get the counter to count to a variable amount that changes within the code, not a set amount (i.e. not 1 to 10, but 1 to x)?
    Last edited by Taemex; 02-05-2014 at 01:05 AM.

  4. #4
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: "Out of Stack Space" error vba Excel 2010

    Alright, I figured out how to do it. I'm still not sure why,

    Please Login or Register  to view this content.
    does not work when x is in the formula and increments in the formula until necessary but, whatever. I just made the loop 1 to 20 and this seems to be enough loops to get what I need checked working so, case closed!

  5. #5
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: "Out of Stack Space" error vba Excel 2010

    I'm currently feeling a level of frustration I've not felt in a very long time. I had to add some to my code for zero division error. I was not working as I expected. I narrowed down the problem to this bit of code:

    Please Login or Register  to view this content.
    When I press the button to run the code, nothing pops up. It does not matter what value I assign formulaX. formulaX works fine in the rest of my code everywhere, allowing me to put it's value into cell ranges, but for whatever wacky reason, it wont in this instance, and this is literally the entirety of my code atm because I erased everything else just to get this tiny code to work, which it does not. Any ideas as to what I'm doing wrong? I'm trying to get AJ11 to have the number 1 in it's cell. I have this exact same code in the rest of my project with formulaX and it displays correctly in AJ11. I'm so confused right now...


    ***EDIT: Apparently it was because I had a non-macro-enabled workbook open at the same time. I'm really beginning to hate Excel 2010... Closed again.
    Last edited by Taemex; 02-05-2014 at 04:43 AM.

+ 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. Excel 2010 - Error Message "The source currently evaluates to an error"
    By dontaylor in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2013, 12:55 PM
  3. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  4. Error: "Out of stack space"
    By richbennett in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2010, 05:07 AM
  5. Run time error - "out of stack space"
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2005, 02:01 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