+ Reply to Thread
Results 1 to 3 of 3

Set of macros giving out of stack space error

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Question Set of macros giving out of stack space error

    Hello,

    I wonder if someone can help, I have the below set of macros that run for a few hours and then give run time error out of stack space. Can anyone see what the issue is?

    I'm pretty certain that it's not the cleanest way to do what I need, so an alternate way can be suggested if that's easier. I'm basically just wanting it to loop through activating 3 sheets and then refreshing the data once in each revolution

    Sub Refresh()
    ActiveWorkbook.RefreshAll
    SlidetoTwo
    End Sub
    
    Sub ShowFirstSheet()
    Sheets("Dashboard 1").Activate
    SlidetoTwo
    End Sub
    
    Sub SlidetoTwo()
    Application.Wait Now + TimeValue("00:00:20")
    Sheets("Dashboard 2").Activate
    SlidetoThree
    End Sub
    
    Sub SlidetoThree()
    Application.Wait Now + TimeValue("00:00:20")
    Sheets("Dashboard 3").Activate
    SlideToOne
    End Sub
    
    Sub SlideToOne()
    Application.Wait Now + TimeValue("00:00:20")
    Sheets("Dashboard 1").Activate
    Refresh
    End Sub
    Thanks in advance for any help!

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,526

    Re: Set of macros giving out of stack space error

    Assuming no one changes the active workbook to another, the following code should be more secure (though not perfect!)
    Sub Refresh()
        ActiveWorkbook.RefreshAll
        Application.OnTime Now + TimeValue("00:00:20"), "SlidetoTwo"
    End Sub
    
    Sub ShowFirstSheet()
        Sheets("Dashboard 1").Activate
        Application.OnTime Now + TimeValue("00:00:20"), "SlidetoTwo"
    End Sub
    
    Sub SlidetoTwo()
        Sheets("Dashboard 2").Activate
        Application.OnTime Now + TimeValue("00:00:20"), "SlidetoThree"
    End Sub
    
    Sub SlidetoThree()
        Sheets("Dashboard 3").Activate
        Application.OnTime Now + TimeValue("00:00:20"), "SlideToOne"
    End Sub
    
    Sub SlideToOne()
        Sheets("Dashboard 1").Activate
        Refresh
    End Sub
    Artik

  3. #3
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Set of macros giving out of stack space error

    Thanks Artik, I'll give it a go

+ 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. Error 28 - Out of Stack Space
    By Beva07 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2019, 11:05 AM
  2. out of stack space error
    By bezbid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2019, 06:13 PM
  3. [SOLVED] Error 28 Stack Space
    By scrabtree23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2015, 09:58 AM
  4. VBA Out of Stack Space Error 28
    By alexcapewell in forum Excel General
    Replies: 9
    Last Post: 10-13-2015, 07:01 AM
  5. Out of stack space error
    By lazyengineer in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-10-2015, 02:24 PM
  6. Excel Error: 28 Out of Stack space
    By AinMn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2010, 01:24 AM
  7. Out of stack space error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-20-2008, 03:47 PM

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