Supportnet / Forum / Tabellenkalkulation
Dateneingabe per Userfrom - Thread Closed
Frage
Hallo zusammen,
sorry, ich bin's schon wieder. Ich hoffe ich nerve nicht. Aber ich kommnicht weiter. Gebe meine Daten in eine Userform ein. Klappt auch soweit alles.
Der Datenbereich findet in den Spalten J:M statt und ab Zeile J32.
Die Daten werden auch soweit richtig hingeschrieben, allerdings
beginnend in J2.
Hier nun der Code:
Option Explicit
Private Sub ComboBox1_Click()
If ComboBox1.ListIndex <> 0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 10)
TextBox2 = Cells(ComboBox1.ListIndex + 1, 11)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 12)
Else
TextBox1 = ""
TextBox2 = ""
TextBox4 = ""
End If
End Sub
Private Sub CommandButton1_Click()
If ComboBox1.ListIndex > 0 Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 = ""
TextBox2 = ""
TextBox4 = ""
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 = [J65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
Cells(xZeile, 10) = TextBox1
Cells(xZeile, 11) = TextBox2
Cells(xZeile, 12) = TextBox4
TextBox1 = ""
TextBox2 = ""
TextBox4 = ""
Columns("J:L").Sort Key1:=Range("J32"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=10, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox1.Clear
aRow = [J65536].End(xlUp).Row
ComboBox1.AddItem "add new Contactperson"
For i = 2 To aRow
ComboBox1.AddItem Cells(i, 1) & ", " & Cells(i, 2)
Next i
ComboBox1.ListIndex = 0
Application.EnableEvents = True
End Sub
Könnte nochmal jemand helfen. Vielen herzlichen Dank vorab, Gruß meikel
[*][sup][i]
*Threadedit*
Admininfo: Führ bitte einen Thread nicht fort indem du Weitere eröffnest, und vermeide Mehrfachanfragen. Die Datenbank und User werden es dir danken. Siehe [u][url=https://supportnet.de/groupfaqs/3]FAQ 2.[/url][/u][/i][/sup]