Out of stack space (Error 28)

Posted on 2016-11-26
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
  • 3
  • 2
LVL 46

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 46

Accepted Solution

Martin Liss earned 500 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 46

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

828 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