Ich habe ein kleines Problem - die Kollegen von hier konnten mir schon viel weiterhelfen hier also versuche ich es nochmals da ;-)
Ich habe ein UserForm -welches Daten in verschiedene Spalten schreibt.
Jetzt beanstandet VBA aber einen Laufzeitfehler 9 (Index ausserhalb des gültigen Bereichs) und zwar in Zeile 4. Das File heisst tatsächlich "Datenquelle_Titel".
Könnt Ihr mir sagen wieso das er diese Fehlermeldung ausspuckt
Anbei der code:
rivate
Sub CommandButton1_Click()
Dim lz As Long
Dim shMain As Worksheet
Set shMain = ThisWorkbook.Sheets("Datenquelle_Titel")
With shMain
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 2) = Me.TextBox1
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 3) = Me.TextBox2
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 4) = Me.TextBox3
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 5) = Me.TextBox4
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 53) = Me.TextBox19
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 54) = Me.TextBox18
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 55) = Me.TextBox17
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 56) = Me.TextBox16
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 35) = Me.TextBox15
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 36) = Me.TextBox14
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 37) = Me.TextBox13
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 38) = Me.TextBox12
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 44) = Me.TextBox25
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 45) = Me.TextBox24
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 46) = Me.TextBox23
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 47) = Me.TextBox22
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 11) = Me.TextBox21
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 12) = Me.TextBox20
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 13) = Me.TextBox31
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 14) = Me.TextBox30
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 19) = Me.TextBox29
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 20) = Me.TextBox28
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 21) = Me.TextBox27
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 22) = Me.TextBox26
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 27) = Me.TextBox8
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 28) = Me.TextBox9
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 29) = Me.TextBox10
lz = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Cells(lz, 30) = Me.TextBox11
'und so weiter den Inhalt jeder Textbox
'in die entsprechende Spalte
End With
End Sub
Danke viel viel mal für eure kompetente Hilfe!
Grüsse & einen sonnigen Tag
Fabian