Option Explicit
Private Sub ComboBox1_Click()
If ComboBox1.ListIndex 0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 4)
TextBox2 = Cells(ComboBox1.ListIndex + 1, 5)
TextBox3 = Cells(ComboBox1.ListIndex + 1, 6)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 7)
TextBox5 = Cells(ComboBox1.ListIndex + 1, 8)
TextBox6 = Cells(ComboBox1.ListIndex + 1, 9)
TextBox7 = Cells(ComboBox1.ListIndex + 1, 10)
TextBox8 = Cells(ComboBox1.ListIndex + 1, 1)
Else
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
End If
End Sub
Private Sub CommandButton1_Click()
If ComboBox1.ListIndex > 0 Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
UserForm_Initialize
End If
End Sub
Private Sub CommandButton2_Click()
Dim xZeile As Long
If TextBox1 = "" Then Exit Sub
If ComboBox1.ListIndex = 0 Then
xZeile = [D65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
Cells(xZeile, 4) = CStr(TextBox1)
Cells(xZeile, 5) = CStr(TextBox2)
Cells(xZeile, 6) = CStr(TextBox3)
Cells(xZeile, 7) = CStr(TextBox4)
Cells(xZeile, 8) = CStr(TextBox5)
Cells(xZeile, 9) = CStr(TextBox6)
Cells(xZeile, 10) = CStr(TextBox7)
Cells(xZeile, 1) = CDate(TextBox8)
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
Columns("A:I").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox8_Change()
End Sub
Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox1.Clear
aRow = [D65536].End(xlUp).Row
ComboBox1.AddItem "choose Date"
For i = 2 To aRow
ComboBox1.AddItem Cells(i, 1)
Next i
ComboBox1.ListIndex = 0
Application.EnableEvents = True
End Sub