2 Replies Latest reply on Aug 17, 2017 10:28 AM by Raymond Yau

    Comparing Array items - VBA

    Raymond Yau

      Hi,

       

      This is more of a VBA rather than a Solidworks question. I'm trying to compare the first item in an array with the second item in the array as follows:

       

              i = 0
              
              For Each i In LengthsArr
              If LengthsArr(i) > LengthsArr(i + 1) Then
              llong = llong + QuanArr(i)
              Else
              Short = Short + QuanArr(i)
              
              End If
              
              Next i
      

       

      It doesn't seem to work, line 4 throws up an error:

       

      "Run-time error: 9: Subscript out of range"

       

      Anybody know why I am getting this?