Laufzeitfehler 1004
22.10.2014 14:01:19
Jens
ich hab leider einen Laufzeitfehler "1004" mit Kommentar: Die Sorte Methode des Ranges Objektes konnte nicht ausgeführt werden.
Der Debuggen ist in der Zeile der Fett gedruckt ist! Ich kann die Datei leider nicht verschicken da diese fast 12 MB hat.
Ich hoffe mir kann einer helfen. Den Code findet ihr im Anhang.
Gruß Jens
Private Sub CommandButton2_Click()
Dim xZeile As Long
If TextBox1 = "" Then Exit Sub
If ComboBox1.ListIndex = 0 Then
xZeile = [A65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
' Übertragen der Daten
Cells(xZeile, 1) = TextBox1
Cells(xZeile, 2) = TextBox2
Cells(xZeile, 3) = TextBox3
Cells(xZeile, 4) = TextBox4
Cells(xZeile, 5) = TextBox5
Cells(xZeile, 7) = TextBox6
Cells(xZeile, 10) = TextBox7
Cells(xZeile, 11) = TextBox8
Cells(xZeile, 12) = TextBox9
Cells(xZeile, 15) = TextBox10
Cells(xZeile, 16) = TextBox11
Cells(xZeile, 17) = TextBox12
Cells(xZeile, 20) = TextBox13
Cells(xZeile, 21) = TextBox14
Cells(xZeile, 22) = TextBox15
Cells(xZeile, 25) = TextBox16
Cells(xZeile, 26) = TextBox17
Cells(xZeile, 27) = TextBox18
Cells(xZeile, 30) = TextBox19
Cells(xZeile, 6) = TextBox20
Cells(xZeile, 41) = CheckBox6
If Gate_Planning.CheckBox1.Value = True Then
Cells(xZeile, 8) = "Y"
End If
If Gate_Planning.CheckBox1.Value = False Then
Cells(xZeile, 8) = " "
End If
If Gate_Planning.CheckBox2.Value = True Then
Cells(xZeile, 13) = "Y"
End If
If Gate_Planning.CheckBox2.Value = False Then
Cells(xZeile, 13) = " "
End If
If Gate_Planning.CheckBox3.Value = True Then
Cells(xZeile, 18) = "Y"
End If
If Gate_Planning.CheckBox3.Value = False Then
Cells(xZeile, 18) = " "
End If
If Gate_Planning.CheckBox4.Value = True Then
Cells(xZeile, 23) = "Y"
End If
If Gate_Planning.CheckBox4.Value = False Then
Cells(xZeile, 23) = " "
End If
If Gate_Planning.CheckBox5.Value = True Then
Cells(xZeile, 28) = "Y"
End If
If Gate_Planning.CheckBox5.Value = False Then
Cells(xZeile, 28) = " "
End If
If Gate_Planning.CheckBox6.Value = True Then
Cells(xZeile, 31) = "x"
End If
If Gate_Planning.CheckBox6.Value = False Then
Cells(xZeile, 31) = " "
End If
'Zellen leeren
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox9 = ""
TextBox10 = ""
TextBox11 = ""
TextBox12 = ""
TextBox13 = ""
TextBox14 = ""
TextBox15 = ""
TextBox16 = ""
TextBox17 = ""
TextBox18 = ""
TextBox19 = ""
TextBox20 = ""
CheckBox6 = ""
CheckBox1 = ""
CheckBox2 = ""
CheckBox3 = ""
CheckBox4 = ""
CheckBox5 = ""
Dim oneRange As Range
Dim aCell As Range
Set oneRange = Range("A3:AD500")
Set aCell = Range("A3")
oneRange.Sort Key1:=aCell, Order1:=xlAscending, Header:=xlYes
UserForm_Initialize
End Sub