Laufzeitfehler 6: Überlauf
06.01.2020 12:49:53
Daniel
beim routinemäßigen Ausführen einer Auswertung bin ich heute erstmalig auf folgendes Problem gestoßen:
Ich ziehe mir zunächst Daten aus einer anderen Exceldatei (siehe CALC_Signings, irrelevante Daten sind in der Tabelle gelöscht) und werte dieser nach der Logik in 1_Auswertung Arrangierungen aus um die gezeigten Positionen zu ermitteln. Nun tritt in der markierten Codezeile der Laufzeitfehler 6: Überlauf auf - ich habe leider keine Ahnung woran das liegen kann.
Könnt ihr mir diesbezüglich helfen?
Vielen Dank im Voraus und frohes neues Jahr!
Der Code:
Sub Update_Auswertung_Arrangierungen()
'Update für Dealflow Arrangierungen
Dim m As Long
Dim y As Long
Dim i As Long
Dim j As Long
Dim margin17 As Variant
Dim margin18 As Variant
Dim count17 As Variant
Dim count18 As Variant
'Gewisse Variablen werden definiert
m = Month(Date)
y = Year(Date)
margin17 = 0
margin18 = 0
count17 = 0
count18 = 0
For j = 2 To i
'selektiert die Daten für Abschlüsse, Volumen, Anteil, avg Vol und avg margin
If Tabelle21.Cells(j, 67).Value = 1 And CStr(Tabelle21.Cells(j, 6).Value) "Waiver" _
_
_
And CStr(Tabelle21.Cells(j, 5).Value) "Partizipation" Then 'aktuelles jahr
Tabelle1.Cells(3, 18).Value = Tabelle1.Cells(3, 18).Value + Tabelle21.Cells(j, 67). _
_
_
Value
Tabelle1.Cells(4, 18).Value = Tabelle1.Cells(4, 18).Value + Tabelle21.Cells(j, 17). _
_
_
Value
Tabelle1.Cells(5, 18).Value = Tabelle1.Cells(5, 18).Value + Tabelle21.Cells(j, 18). _
_
_
Value
If Tabelle21.Cells(j, 69).Value "0" Then
margin18 = margin18 + Tabelle21.Cells(j, 69).Value
count18 = count18 + 1
End If
ElseIf Tabelle21.Cells(j, 68).Value = 1 And CStr(Tabelle21.Cells(j, 6).Value) " _
Waiver" And CStr(Tabelle21.Cells(j, 5).Value) "Partizipation" Then 'letztes jahr
Tabelle1.Cells(3, 17).Value = Tabelle1.Cells(3, 17).Value + Tabelle21.Cells(j, 68). _
_
_
Value
Tabelle1.Cells(4, 17).Value = Tabelle1.Cells(4, 17).Value + Tabelle21.Cells(j, 17). _
_
_
Value
Tabelle1.Cells(5, 17).Value = Tabelle1.Cells(5, 17).Value + Tabelle21.Cells(j, 18). _
_
_
Value
If Tabelle21.Cells(j, 69).Value "0" Then
margin17 = margin17 + Tabelle21.Cells(j, 69).Value
count17 = count17 + 1
End If
End If
'zählt arrangierungen, debuts, refis und waiver
If Tabelle21.Cells(j, 67).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Neu / Debut" Then 'aktuelles jahr
Tabelle1.Cells(9, 18).Value = Tabelle1.Cells(9, 18).Value + 1
ElseIf Tabelle21.Cells(j, 67).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Refinanzierung" Then
Tabelle1.Cells(10, 18).Value = Tabelle1.Cells(10, 18).Value + 1
ElseIf Tabelle21.Cells(j, 67).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Amendment" Then
Tabelle1.Cells(11, 18).Value = Tabelle1.Cells(11, 18).Value + 1
ElseIf Tabelle21.Cells(j, 67).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Waiver" Then
Tabelle1.Cells(12, 18).Value = Tabelle1.Cells(12, 18).Value + 1
End If
If Tabelle21.Cells(j, 68).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Neu / Debut" Then 'letztes jahr
Tabelle1.Cells(9, 17).Value = Tabelle1.Cells(9, 17).Value + 1
ElseIf Tabelle21.Cells(j, 68).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Refinanzierung" Then
Tabelle1.Cells(10, 17).Value = Tabelle1.Cells(10, 17).Value + 1
ElseIf Tabelle21.Cells(j, 68).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Amendment" Then
Tabelle1.Cells(11, 17).Value = Tabelle1.Cells(11, 17).Value + 1
ElseIf Tabelle21.Cells(j, 68).Value = 1 And CStr(Tabelle21.Cells(j, 5).Value) " _
Partizipation" And CStr(Tabelle21.Cells(j, 6).Value) = "Waiver" Then
Tabelle1.Cells(12, 17).Value = Tabelle1.Cells(12, 17).Value + 1
End If
Next
Range("Q6").Select
ActiveCell.FormulaR1C1 = "=R[-2]C/R[-3]C"
Range("R6").Select
ActiveCell.FormulaR1C1 = "=R[-2]C/R[-3]C"
Tabelle1.Cells(7, 17).Value = "ca. " & Round((margin17 / count17) * 100, 1) & " %"
Tabelle1.Cells(7, 18).Value = "ca. " & Round((margin18 / count18) * 100, 1) & " %"
If m - 1