Application Defined error:

Application Defined error:

What does this error mean?

Here's the code where i got that error. (the one in bold was the line where the error registered.)
This code is originally written in excel and migrated it to zoho's version. Also attached in this post is the original excel vba macro.

Here's the link

Zoho

Sub APSMRUN()

    STOCHSW = Application.Range("WPSW")   'Value of stochastic switch
    If STOCHSW = 1 Then Goto JUMP1
    Range("NOW").Select
    Selection.Copy
    Range("START").Select
    ActiveSheet.Paste

JUMP1:
    Call ADELEFIN
    Calculate
    Range("WPST").Select
    Selection.Copy
    Range("WPST1").Select
    ActiveSheet.Paste

Dim NCYCLES As Integer
Dim TMAX As Integer
Dim NCROPS As Integer
Dim NLIVST As Integer
Dim GMA As Integer

    NCYCLES = Application.Range("NCYC")    'x-number of cycles/periods in the simulation
    TMAX = Application.Range("NITR")       'x-maximum number of iterations per cycle
    NCROPS = Application.Range("NC")       '9- number of crops market modeled
    NLIVST = Application.Range("NL")       '6- number of livestock markets modeled
    ZLIMIT = Application.Range("ZTL")
    NCOMM = NCROPS + NLIVST
    GMA = 0
    
    For CYCINDX = 1 To NCYCLES     'This is really the period or year
    
        Range("NPERIOD").Select
        ActiveCell.value = CYCINDX
        
        For ITER = 1 To TMAX

            If ITER > 1 Then Goto AAA:
                Range("PVARDP1").Select
                ActiveCell.Offset(1, 0).Range("A1:H49").Formula = 0
        
            AAA:
            Range("DPG").Select
            ActiveCell.Offset(7, 2).Range("A1").Select
            Range("DPRICES1").Select
            ActiveCell.Offset(ITER, 0).Range("A1").Select
            Let NZERO = 0
            
                For COMMINDX = 1 To NCOMM
                    ActiveCell.Offset(0, 1).Range("A1").Select
                    If Abs(ActiveCell) <= ZLIMIT Then NZERO = NZERO + 1
                Next
                If NZERO = NCOMM Then GoTo RECITERNO
        Next
        MsgBox "No convergence after " & TMAX & " iterations"
        
    RECITERNO:
        Range("NITER").Select
        ActiveCell.value = ITER

        Range("AREA1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("AREAFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("YIELD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("YLDFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste
        
        Range("PRICE1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("PRICEFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste


        Range("DURB1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("DURBFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste
        
        Range("DRUR1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("DRURFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("TFOOD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("TFOODFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("TOTD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("TOTDFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("NIMP1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("NIMPFIN1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LCYLD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVCYLD1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LPROD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVPROD1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LPRICE1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVPRICE1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LDURB1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVDURB1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LDRUR1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVPCRUR1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LFOOD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVTFOOD1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LTOTD1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVTDEM1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

        Range("LNIMP1").Select
        ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
        Range("LVNIMP1").Select        
        ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
        ActiveSheet.Paste

    Next
        STOCHSW = Application.Range("WPSW")   'Value of stochastic switch
        If STOCHSW = 1 Then Goto JUMP2
        Range("NOW").Select
        Selection.Copy
        Range("END").Select
        ActiveSheet.Paste
    
        SIMELAPSED = Application.Range("ELAPSED")
        MsgBox "Simulation Run Completed, " & SIMELAPSED & " ELAPSED "
        Range("DATERUN").Select
        Selection.Copy
        Range("RUNDATE").Select
        ActiveSheet.Paste
    
    JUMP2:
    Range("OPTIONS").Select
    
End Sub

Excel

Sub APSMRUN()
'
' APSMRUN Macro recorded 11/13/2003, 07/23/2004 by Tirso B. Paris, Jr.
' This macro integrates all the individual routines
'
'  Copy contents of previous simulation run to another area in the worksheet
'       for comparison with current simulation
'    Run ("CopySimRes")
'      MsgBox "Previous simulation results copied safely"
'  Delete the contents of previous final tables to make way for a new simulation.
'
    STOCHSW = Application.Range("WPSW")   'Value of stochastic switch
    If STOCHSW = 1 Then GoTo JUMP1
    Application.Goto Reference:="NOW"
    Selection.Copy
    Application.Goto Reference:="START"
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
'
JUMP1:
    Run ("ADELEFIN")
    Calculate
    Application.Goto Reference:="WPST"
    Selection.Copy
    Application.Goto Reference:="WPST1"
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False
'
'
'*      MsgBox "Final worksheets deleted"
'
'   Set levels of policy variables and exogenous variables for entire
'       simulation period. Note that at this stage the system is not
'       yet subject to exogenous shocks.
'
Dim NCYCLES As Integer
Dim TMAX As Integer
Dim NCROPS As Integer
Dim NLIVST As Integer
Dim GMA As Integer


'  Initialize variables
'
    NCYCLES = Application.Range("NCYC")    '20-number of cycles/periods in the simulation
    TMAX = Application.Range("NITR")       '50-maximum number of iterations per cycle
    NCROPS = Application.Range("NC")       '9- number of crops market modeled
    NLIVST = Application.Range("NL")       '6- number of livestock markets modeled
    ZLIMIT = Application.Range("ZTL")
    NCOMM = NCROPS + NLIVST
    GMA = 0
    
'
'  In the following,
'  CYCINDX is the index for cycles (periods or years)
'  ITER is the index for ITERATIONS
'  K is the index for counting
'
    For CYCINDX = 1 To NCYCLES     'This is really the period or year
    
        Application.Goto Reference:="NPERIOD"
        ActiveCell = CYCINDX
        
 
'   Start of iterative routine to determine endogenously
'   equilibrium values.
    For ITER = 1 To TMAX
 '  Shock system in the first iteration
        If ITER > 1 Then GoTo AAA:

'   This is the portion that assigns zero to the rest of table.
    Application.Goto Reference:="PVARDP1"
    ActiveCell.Offset(1, 0).Range("A1:H49").Formula = 0
        
AAA:
'   At this stage, all values of
'   state variables (for TMAX iterations) are computed using
'   the initial shock values (policy variable changes).
'   The following routine simply determines the iteration number
'   wherein all crop and livestock markets have cleared.
    
'
        Application.Goto Reference:="DPG"
        ActiveCell.Offset(7, 2).Range("A1").Select
        Application.Goto Reference:="DPRICES1"
        ActiveCell.Offset(ITER, 0).Range("A1").Select
            Let NZERO = 0
            For COMMINDX = 1 To NCOMM
                ActiveCell.Offset(0, 1).Range("A1").Select
                If Abs(ActiveCell) <= ZLIMIT Then NZERO = NZERO + 1
            Next
        If NZERO = NCOMM Then GoTo RECITERNO
    Next
        MsgBox "No convergence after " & TMAX & " iterations"
        
RECITERNO:
    Application.Goto Reference:="NITER"
    ActiveCell = ITER
'   MsgBox "Convergence achieved after " & ITER & " iterations!"
'
'   Variable = Crop Area
    Application.Goto Reference:="AREA1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="AREAFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Crop Yield
    Application.Goto Reference:="YIELD1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="YLDFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
    
'   Variable = Crop Price
    Application.Goto Reference:="PRICE1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="PRICEFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Crop Urban Demand
    Application.Goto Reference:="DURB1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="DURBFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Crop Rural Demand
    Application.Goto Reference:="DRUR1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="DRURFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Total Food Crop Demand
    Application.Goto Reference:="TFOOD1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="TFOODFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
 '
'   Variable = Total Crop Demand
    Application.Goto Reference:="TOTD1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="TOTDFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Net Imports - Crops
    Application.Goto Reference:="NIMP1"
    ActiveCell.Offset(ITER, 0).Range("A1:I1").Copy
    Application.Goto Reference:="NIMPFIN1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
' FOR LIVESTOCK
'   Variable = CARCASS Yield
    Application.Goto Reference:="LCYLD1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVCYLD1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
    
'   Variable = MEAT PRODUCTION
    Application.Goto Reference:="LPROD1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVPROD1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
    
'   Variable = MEAT Price
    Application.Goto Reference:="LPRICE1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVPRICE1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = MEAT Urban Demand
    Application.Goto Reference:="LDURB1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVPCURB1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = MEAT Rural Demand
    Application.Goto Reference:="LDRUR1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVPCRUR1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Total MEAT FOOD Demand
    Application.Goto Reference:="LFOOD1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVTFOOD1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
 '
'   Variable = Total MEAT Demand
    Application.Goto Reference:="LTOTD1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVTDEM1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
'
'   Variable = Net Imports - MEAT
    Application.Goto Reference:="LNIMP1"
    ActiveCell.Offset(ITER, 0).Range("A1:F1").Copy
    Application.Goto Reference:="LVNIMP1"
    ActiveCell.Offset(CYCINDX - 1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlValues
Next
    STOCHSW = Application.Range("WPSW")   'Value of stochastic switch
    If STOCHSW = 1 Then GoTo JUMP2
    Application.Goto Reference:="NOW"
    Selection.Copy
    Application.Goto Reference:="END"
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    SIMELAPSED = Application.Range("ELAPSED")
    MsgBox "Simulation Run Completed, " & SIMELAPSED & " ELAPSED "
    Application.Goto Reference:="DATERUN"
    Selection.Copy
    Application.Goto Reference:="RUNDATE"
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False
JUMP2:
    Application.Goto Reference:="OPTIONS"
    
End Sub

Thanks for the help :)

      • Sticky Posts

      • Slicers are now available in Zoho Sheet—filter your data interactively

        At Zoho Sheet, we diligently track user requests and feedback. In line with this, based on extensive user requests, we've integrated Slicers to pivot tables and are delighted to announce its release. Slicers are interactive visual filters that have add,
      • Check out the new Checkbox in Zoho Sheet

        Checkbox, the simple GUI widget that lets you choose between two mutually exclusive options i.e Yes or No, is now in Zoho Sheet. Having made it across the web, Checkbox is familiar but is still elusive to most spreadsheet software. Special developer ribbons, macros and all other complexities to add a checkbox to a spreadsheet? Not in Zoho Sheet. How to add Checkbox to Zoho Sheet? Adding a Checkbox in Zoho Sheet is simple. Select a cell/range and choose "Checkbox" in "Input Controls" under the Format
      • Format and analyze spreadsheet data with Zoho Sheet's Table

        While a spreadsheet helps you compile data for easy analysis, formatting helps make your data more comprehensible. We are happy to announce the release of Table, a crucial tool for improving data formatting in Zoho Sheet. More than a formatting tool,
      • Introducing Data Bars: Graphically represent changes in data within the cells

        Conditional formatting has helped millions of spreadsheet users analyze and highlight their data more efficiently. In addition to the classic rules, color scales, and icon sets available in Zoho Sheet, you can now apply Data Bars, a convenient method
      • Zia in Zoho Sheet now makes suggestions on conditional formats, picklists, and checkboxes

        Zia, Zoho's popular AI assistant, has been helping users succeed across Zoho applications since inception. In Zoho Sheet, Zia helps users efficiently build reports and analyze data with recommendations about data cleaning, charts, and pivot table. Also,