Out of stack space (Error 28)

Posted on 2016-11-26
Medium Priority
Last Modified: 2016-11-29
Attempting to modify VBA to suit my Userform template in the attached file for column references but getting Out of stack space (Error 28) and Excel crashes.

Any assistance as to why this is happening would be greatly appreciated.

Question by:Paul Clayton
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 49

Expert Comment

by:Martin Liss
ID: 41902398
What action do you take that results in the error? Is it associated with clicking one of the buttons for example?

Author Comment

by:Paul Clayton
ID: 41902752
The run error occurs and thereafter Excel shuts down when I try to change the VBA code to reflect the worksheet column that I want as the txt box value on the Userform, i.e., as below from 6 to 12
        .txtPMthRev = Format(ws.Cells(lRw, 6), "#,##0.00")

Open in new window

        .txtPMthRev = Format(ws.Cells(lRw, 12), "#,##0.00")

Open in new window

LVL 49

Accepted Solution

Martin Liss earned 2000 total points
ID: 41902758
Here's what I did. I changed .txtPMthRev = Format(ws.Cells(lRw, 6), "#,##0.00") to .txtPMthRev = Format(ws.Cells(lRw, 12), "#,##0.00") in the LoadBoxes sub. I then went into Visual Basic, selected the userform and pressed F5. I then get an error when Form_Initialized called LoadBoxes because of the #N/A cell L2, but after ignoring that I was able to click "Next Record" more than 30 times and did not have a problem. What did you do different if anything?

Author Closing Comment

by:Paul Clayton
ID: 41905644
LVL 49

Expert Comment

by:Martin Liss
ID: 41905949
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question