Ich habe eine Userform in dieser habe ich mehrere Textboxen und Comboboxen die ich in eine Tabelle einfüge und zwar immer in die erste freie Zelle der jeweiligen Spalten, jetzt habe ich aber das Problem dass ich in dieser Tabelle teilweise Werte wieder raus löschen muss und dann diese Zellen leer sind, sprich wenn ich das nächstemal von der Userform übertrage sind die Werte auf der faltschen Zeile.
Ich habe mir gedacht ich übertrage Textbox eins in Spalte A diese bleibt immer bestehen und dann kopiere ich die anderen Textboxen und Comboboxen auf die selbe Zeile.
Mein Problem ist nur ich bringe den Code nicht hin dass, das funktioniert.
Oder hat jemand noch einen bessere idee wie ich mein Problem lösen könnte.
Mein Code:
Dim ct As Control
For Each ct In Me.Controls
If TypeName(ct) = "TextBox" Or TypeName(ct) = "ComboBox" Then
If ct.Value = "" Then ct.Value = " "
End If
Next
On Error Resume Next
Cells(Cells(Rows.Count, "A").End(xlUp).Row + 1, "A").Select
Cells(Cells(Rows.Count, "B").End(xlUp).Row + 1, "B").Value = TextBox1
Cells(Cells(Rows.Count, "C").End(xlUp).Row + 1, "C").Value = ComboBox1
Cells(Cells(Rows.Count, "H").End(xlUp).Row + 1, "H").Value = ComboBox5
Cells(Cells(Rows.Count, "I").End(xlUp).Row + 1, "I").Value = TextBox4
Cells(Cells(Rows.Count, "J").End(xlUp).Row + 1, "J").Value = TextBox5
Cells(Cells(Rows.Count, "D").End(xlUp).Row + 1, "D").Value = TextBox6 * 1
Cells(Cells(Rows.Count, "F").End(xlUp).Row + 1, "F").Value = TextBox7
Cells(Cells(Rows.Count, "G").End(xlUp).Row + 1, "G").Value = ComboBox2
Cells(Cells(Rows.Count, "K").End(xlUp).Row + 1, "K").Value = TextBox9
Cells(Cells(Rows.Count, "A").End(xlUp).Row + 1, "A").Value = TextBox10
Cells(Cells(Rows.Count, "L").End(xlUp).Row + 1, "M").Value = ComboBox3
Cells(Cells(Rows.Count, "L").End(xlUp).Row + 1, "L").Value = ComboBox4