Überlauffehler und Falscher Datenty bei SVERWEIS
09.06.2016 09:41:48
Jonny
Folgendes Problem-Programm:
Dim w As String: Dim i As Integer
Dim w2 As String: Dim n As Integer
Dim w3 As Double
Dim A As Integer: Dim h As Double: Dim h2 As Double
Dim B As Integer: Dim k As Double: Dim k2 As Double
Dim C As Integer: Dim l As Double: Dim l2 As Double
Dim D As Integer: Dim o As Double: Dim o2 As Double
Do
w = Sheets("Maßnahmenplan").Cells(i, "I").Value --Text oder Leer
w2 = Sheets("Maßnahmenplan").Cells(i, "K").Value -- Wert aus SVERWEIS (zeigte Fehler falscher Datentyp, wird jetzt plötzlich nicht mehr angezeigt)
w3 = Sheets("Maßnahmenplan").Cells(i, "M").Value --Prozentzahl
If w2 = "Hans" Then
A = A + 1
h = h + w3
Else
A = A
h = h
End If
If w2 = "Klaus" Then
B = B + 1
k = k + w3
Else
B = B
k = k
End If
If w2 = "Erik" Then
C = C + 1
l = l + w3
Else
C = C
l = l
End If
If w2 = "Ramona" Then
D = D + 1
o = o + w3
Else
D = D
o = o
End If
Loop Until w = ""
h2 = h / A --Fehler 6 Überlauf
k2 = k / B
l2 = l / C
o2 = o / D
Sheets("Database").Cells(30, "B").Value = A
Sheets("Database").Cells(31, "B").Value = B
Sheets("Database").Cells(32, "B").Value = C
Sheets("Database").Cells(33, "B").Value = D
Sheets("Database").Cells(37, "C").Value = h2
Sheets("Database").Cells(37, "C").Value = k2
Sheets("Database").Cells(37, "C").Value = l2
Sheets("Database").Cells(37, "C").Value = o2
Ich verstehe nicht, warum
1. der Wert aus dem SVERWEIS nicht angenommen wurde und jetzt ohne eine Veränderung doch angenommen wird und
2. Was mir der Überlauf-Fehler sagen soll und warum er bei einem anderen (fast) gleichen Programm nicht auftritt obwohl die Art der Werte gleich ist.
Danke schon mal für Eure Hilfe!
Viele Grüße,
Jonny
Anzeige