Laufzeitfehler 424
24.05.2015 10:22:54
DaMe
könnte mir jemand sagen warum bei dem Code der oben genannte Laufzeitfehler auftritt?
Hier der Code:
'Definition der Variablen
Dim j As Integer
Dim a As Integer
Dim b As Integer
Dim UWF As Variant
'Schließen der Userform
Unload UserForm1
' Welche Distanz-Berechnungsvorschrift wird gewählt?
AnzahlZeilen = Cells(Rows.Count, 1).End(xlUp).Row
j = 2
If opbEuklidisch.Value = True Then
For b = 12 To AnzahlZeilen
For a = 2 To AnzahlZeilen
Cells(a, b) = Sqr((Cells(a, 2) - Cells(j, 2)) ^ 2 + (Cells(a, 3) - Cells(j, 3)) ^ 2)
Next a
j = j + 1
Next b
ElseIf opbManhattan.Value = True Then
For b = 12 To AnzahlZeilen
For a = 2 To AnzahlZeilen
Cells(a, b) = Abs(Cells(a, 2) - Cells(j, 2) + Cells(a, 3) - Cells(j, 3))
Next a
j = j + 1
Next b
Else
UWF = InputBox("Bitte geben Sie den Umwegfaktor (UWF) an")
For b = 12 To AnzahlZeilen
For a = 2 To AnzahlZeilen
Cells(a, b) = UWF * Sqr((Cells(a, 2) - Cells(j, 2)) ^ 2 + (Cells(a, 3) - Cells(j, 3)) ^ 2)
Next a
j = j + 1
Next b
End If
End Sub
Vielen Dank schonmal!