Hello!

I'm writing a Macro that is working with two different sheets with the same data for different times, it's gonna take one column from the last one and compare it to a column from the other sheet. The Sheet contains about 2900 rows, and each word/value that it checks must be found in the other one (because they can be changed dissapear betwen timeperiods).
When I've, for a test, made the two sheets with less values (like 20 instead) it works. The error points at the first loop.

Anyway here's the code:
Type Data
    namn As String
    Klick As Integer
    position As Long
    omv_frekv As Integer
    d_cash As Long
    d_position As Integer
    cash As Integer
        
End Type

Sub omvandling()
Dim i, c, prev_pos, prev_cash As Long
Dim temp_w, svar As Long

i = 1
c = 1
vinst_m = 0.3

Dim Ord(4000) As Data
Dim gamla_Ord(4000) As Data

Sheets("blad1").Select
   
Do
    gamla_Ord(c).namn = Range("B1").Offset(c, 0)
    gamla_Ord(c).Klick = Range("G1").Offset(c, 0)
    gamla_Ord(c).position = Range("L1").Offset(c, 0)
    gamla_Ord(c).cash = Range("Q1").Offset(c, 0) * vinst_m - Range("K1").Offset(c, 0)
    gamla_Ord(c).d_cash = Ord(i).cash - prev_cash
    gamla_Ord(c).d_position = Ord(i).position - prev_pos
    c = c + 1
Loop While IsEmpty(Range("A1").Offset(c, 0)) = False

Sheets("blad2").Select

Do While IsEmpty(Range("A1").Offset(i, 0)) = False

    Ord(i).namn = Range("B1").Offset(i, 0)
    'Ord(i).Klick = Range("G1").Offset(i, 0)
    Ord(i).position = Range("L1").Offset(i, 0)
    Ord(i).cash = Range("Q1").Offset(i, 0) * vinst_m - Range("K1").Offset(i, 0)
             
    For ii = 1 To c
        If Ord(i).namn = gamla_Ord(ii).namn Then
            Ord(i).d_position = Ord(i).position - gamla_Ord(ii).position
            Ord(i).d_cash = Ord(i).cash - gamla_Ord(ii).cash
        End If
    Next ii

    Range("V2").Offset(i, 0) = vinst_m * Range("Q2").Offset(i, 0) - Range("K2").Offset(i, 0)
    i = i + 1
    Range("V1").Offset(i, 0) = Ord(i).d_cash
    Range("W1").Offset(i, 0) = Ord(i).d_position
    
Loop


End Sub