+ Reply to Thread
Results 1 to 11 of 11

Error when running one of 5 Macros in new version of Excel

  1. #1
    Registered User
    Join Date
    04-24-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    83

    Error when running one of 5 Macros in new version of Excel

    Hello all,

    Never had this problem before. I recently switched to a 64bit version of excel, and one of the 5 macros that I use now hit's me with out of stack space error 28. When I first made the switch, the error would pop up early in the macro, now it's toward the end of the macro.

    Any thoughts about what I need to do? The first Bold Italic UL is where the macro was failing when I first switched, now it fails at the second one. I removed some specific names from the second part of the macro, so that's not random unneeded space.

    TIA

    Please Login or Register  to view this content.
    Last edited by the machine; 08-05-2022 at 07:27 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-12-2021
    Location
    CT
    MS-Off Ver
    365
    Posts
    462

    Re: Error when running one of 5 Macros in new version of Excel

    The correct way to run a macro within a macro is (sheetname/modulename).(macroname)

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Error when running one of 5 Macros in new version of Excel

    I don't think it is good practice to call the subroutine AND the GoSub routine the same name (Gray). It is, at best, confusing and, at worst, perhaps problematic.

    Took me a while to find out what combination of values to put in such that the row did NOT turn gray, but got there in the end.

    I'd put some debug statements in, something like the following, to try to track where the routine fails and what the key fields are at the time.

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    04-24-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    83

    Re: Error when running one of 5 Macros in new version of Excel

    Quote Originally Posted by TMS View Post
    I don't think it is good practice to call the subroutine AND the GoSub routine the same name (Gray).....
    Attachment 790408

    No luck here either. Now it's ending early in the run like it did before.
    Last edited by the machine; 08-05-2022 at 07:25 AM.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Error when running one of 5 Macros in new version of Excel

    Please:

    1. Add code tags to your original post
    2. Do NOT quote whole posts in your replies; it is just clutter
    3. Post a sample workbook with typical data that demonstrates the problem
    4. The attachment is invalid so I don't know what that says.

    I can only help you if there is something to work on. Otherwise it is just guesswork.

  6. #6
    Registered User
    Join Date
    04-24-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    83

    Re: Error when running one of 5 Macros in new version of Excel

    It is just a photo of the error

    macro crashes here.

    Case Is < 500000: GoSub Gray

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Error when running one of 5 Macros in new version of Excel

    Thanks for adding the code tags and removing the clutter.

    A picture is still not very helpful. I can get get your code to run with a small file I have created and I can get diagnostic information from it. However, that clearly does not reflect the issue that you have.

    I have 32 bit Excel so it does not reflect your environment. But, if your data runs or fails for me, it will send us along one path or another. If it works for me but not for you, it is possibly the environment (64 bit). If it does not work for me, it is possibly the data. So, "possibilities" that need to be explored.

  8. #8
    Registered User
    Join Date
    04-24-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    83

    Re: Error when running one of 5 Macros in new version of Excel

    Yes, I'm assuming it has to do with the 64 bit version. I wasn't sure if there were any way to fix this.

    Using my file I can get it to run to nearly then end so I only have to manually check two items, which isn't too bad.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Error when running one of 5 Macros in new version of Excel

    Yes, I'm assuming it has to do with the 64 bit version. I wasn't sure if there were any way to fix this.
    Still an assumption. I can't see anything obvious in the code that would be an issue. But no way I can help you to eliminate it.

    That said, as long as I have been programming in Excel with VBA, I have never used GoSub, and never will. I know nothing of its merits or disadvantages but it doesn't fit with the way I code. Given that you don't use Return from the GoSub, you probably don't need GoSub anyway and could get away with a simple GoTo.

    I would be inclined to make the Gray (GoSub line) into a separate function and pass it the row number.

  10. #10
    Registered User
    Join Date
    04-24-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    83

    Re: Error when running one of 5 Macros in new version of Excel

    TMS, I am not good with coding. This was done here back in 2018 by someone else

    https://www.excelforum.com/excel-pro...-criteria.html

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Error when running one of 5 Macros in new version of Excel

    My take on how this could be coded. In my view, this is taking a more positive approach to which rows to colour. Obviously you would need to check it highlights the correct entries for the correct conditions.

    Please Login or Register  to view this content.

+ 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. Replies: 7
    Last Post: 03-29-2022, 09:38 AM
  2. Macros work in one version of Excel 2003 but not in another version of Excel 2003
    By John_Carroll in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-27-2009, 09:30 AM
  3. Running two version of Excel
    By boylejob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2008, 11:08 AM
  4. [SOLVED] How do I know what version of excel I am running?
    By kellyws in forum Excel General
    Replies: 4
    Last Post: 05-13-2006, 02:45 PM
  5. Replies: 0
    Last Post: 04-19-2006, 09:20 AM
  6. Error closing Excel after running series of macros
    By PT_VBA_GRRL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2006, 05:25 PM
  7. version compatibility of excel macros
    By AFlannery in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2005, 09:05 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