Results 1 to 4 of 4

Runtime Error 28 Out of stack space = headache!

Threaded View

SportyJim1979 Runtime Error 28 Out of stack... 09-21-2012, 03:54 PM
shg Re: Runtime Error 28 Out of... 09-21-2012, 03:58 PM
SportyJim1979 Re: Runtime Error 28 Out of... 09-21-2012, 04:07 PM
Cutter Re: Runtime Error 28 Out of... 09-21-2012, 09:06 PM
  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    12

    Runtime Error 28 Out of stack space = headache!

    Hello there,

    Im having trouble with a macro... Im trying to run a macro from a Worksheet_Calculate

    Although the macro is activating it seems to get caught in a loop and comes up with a Runtime Error 28 Out of stack space message. I've tried a few ways around it but nothing seems to work. The Macro does move around to different sheets which seems to cause the problem. The code is below, and help greatly appreciated!

    Private Sub Worksheet_Calculate()
      Dim FormulaRange As Range
    
    
        Set FormulaRange = Me.Range("B9")
    
        For Each formulacell In FormulaRange.Cells
         With formulacell
    
         If .Value > 0.99 Then
        
         
      'Player A
            If Range("J15") = 3 And Range("B3") = 0 Or Range("B2") = 0 And Range("J15") = 3 Then
            'Back / Lay value flat & ready to cancel
             Cancel_PlayerA
              Else
            If Range("B3") = 0 And Range("J13") = 0 Then
            'Lay value flat & not laid
             LAY_Player_A
              Else
            If Range("B2") = 0 And Range("J12") = 0 Then
            'Back value flat & not backed
             BACK_Player_A
              Else
            If Range("B2") = 0 Or Range("B3") = 0 And Range("J14") = 0 Then
            'Back / Lay value flat not yet ready to cancel
             Range("J14") = 1
              Else
              
            End If
            End If
            End If
            End If
        
        
        
        'Player B
            If Range("B4") = 0 And Range("K15") = 3 Or Range("B5") = 0 And Range("K15") = 3 Then
               'Back / Lay value flat & ready to cancel
             Cancel_PlayerB
              Else
            If Range("B5") = 0 And Range("K13") = 0 Then
            'Lay value flat & not laid
             LAY_Player_B
              Else
            If Range("B4") = 0 And Range("K12") = 0 Then
             'Back value flat & not backed
             BACK_Player_B
              Else
            If Range("B4") = 0 Or Range("B5") = 0 And Range("K14") = 0 Then
            'Back / Lay value flat not yet ready to cancel
             Range("K14") = 1
              Else
              
            End If
            End If
            End If
            End If
           End If
         End With
            Next formulacell
    
    End Sub
    Last edited by Cutter; 09-21-2012 at 09:05 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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