AW: UserFo Combobox Eintrag in zweites Blatt eintragen
Beni
Hallo Drazen,
Gruss Beni
Private Sub cmd_Ok_Click()
Dim Beruf As String
Dim lz As Integer
Dim c
Beruf = ComboBox1
With Sheets("Tabelle2").Columns(1)
Set c = .Find(What:=Beruf, LookIn:=xlValues, LookAt:=xlWhole)
lz = .Cells(Rows.Count, 1).End(xlUp).Row
If c Is Nothing Then .Cells(lz + 1, 1) = Beruf
Range(.Cells(2, 1), .Cells(lz + 1, 1)).Sort Key1:=.Cells(2, 1)
End With
With Sheets("Tabelle1")
lz = .Cells(Rows.Count, 1).End(xlUp).Row
.Cells(lz + 1, 1) = txt_sur
.Cells(lz + 1, 2) = txt_nam
.Cells(lz + 1, 3) = txt_nick
.Cells(lz + 1, 4) = ComboBox1
Unload Me
End With
End Sub
Private Sub cmd_Out_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim aRow, i As Integer
With Sheets("Tabelle2")
aRow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To aRow
ComboBox1.AddItem .Cells(i, 1)
Next i
End With
ComboBox1.ListIndex = 0
End Sub