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 :)

    Access your files securely from anywhere

        All-in-one knowledge management and training platform for your employees and customers.






                              Zoho Developer Community




                                                    • Desk Community Learning Series


                                                    • Digest


                                                    • Functions


                                                    • Meetups


                                                    • Kbase


                                                    • Resources


                                                    • Glossary


                                                    • Desk Marketplace


                                                    • MVP Corner


                                                    • Word of the Day


                                                    • Ask the Experts



                                                              • Sticky Posts

                                                              • What's new in Zoho Sheet: Simplify data entry and collaboration

                                                                Hello, Zoho Sheet community! Last year, our team was focused on research and development so we could deliver updates that enhance your spreadsheet experience. This year, we’re excited to deliver those enhancements—but we'll be rolling them out incrementally
                                                              • New Features: Repeat Last Action, Insert Cut/Copied Rows/Columns and Hyperlink

                                                                You might have noticed the constant updates to Zoho Sheet of late. Here are 3 more features that have been added to Zoho Sheet recently: F4 - Repeat Last Action Insert Cut/Copied Rows and Columns Insert Hyperlink Here is a screen cast demonstrating each of these features. Read further below to learn more about these new features. F4 - Repeat Last Action: You can now repeat the last action you made on your spreadsheet by using the keyboard shortcut, F4. It is quite handy and helps you get your work
                                                              • Introducing Forms in Zoho Sheet

                                                                We hereby bring you the power of ​forms in Zoho Sheet. ​Now, build and create your own customized forms using Zoho Sheet. Be it compiling a questionnaire or rolling out a survey, Zoho Sheet can do it all for you. Forms is an excellent feature that helps you collect information in the simplest of ways and having it in Zoho Sheet takes it a notch higher. Build Simple yet Powerful forms Building forms using Zoho Sheet is fairly simple. The exclusive 'Form' tab lets you create one quickly. Whether you
                                                              • 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,
                                                              • 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


                                                              Manage your brands on social media



                                                                    Zoho TeamInbox Resources



                                                                        Zoho CRM Plus Resources

                                                                          Zoho Books Resources


                                                                            Zoho Subscriptions Resources

                                                                              Zoho Projects Resources


                                                                                Zoho Sprints Resources


                                                                                  Qntrl Resources


                                                                                    Zoho Creator Resources



                                                                                        Zoho CRM Resources

                                                                                        • CRM Community Learning Series

                                                                                          CRM Community Learning Series


                                                                                        • Kaizen

                                                                                          Kaizen

                                                                                        • Functions

                                                                                          Functions

                                                                                        • Meetups

                                                                                          Meetups

                                                                                        • Kbase

                                                                                          Kbase

                                                                                        • Resources

                                                                                          Resources

                                                                                        • Digest

                                                                                          Digest

                                                                                        • CRM Marketplace

                                                                                          CRM Marketplace

                                                                                        • MVP Corner

                                                                                          MVP Corner









                                                                                            Design. Discuss. Deliver.

                                                                                            Create visually engaging stories with Zoho Show.

                                                                                            Get Started Now


                                                                                              Zoho Show Resources

                                                                                                Zoho Writer

                                                                                                Get Started. Write Away!

                                                                                                Writer is a powerful online word processor, designed for collaborative work.

                                                                                                  Zoho CRM コンテンツ




                                                                                                    Nederlandse Hulpbronnen


                                                                                                        ご検討中の方