AW: Eingabemaske gefunden, nun erweitern
03.10.2006 18:24:44
Thorsten_Z
Gut das du fragst hab grade noch einen Fehler gefunden ;-)
Du mußt noch eine CodeZeile ergänzen. Da wo Achtung steht!!!!!
Du öffnest als erstes den VBA Editor und klickst doppelt auf die UserForm, so das dir der Code angezeigt wird. In der UserForm selber habe ich das zusätzliche Textfeld mit der Überschrift eingefügt. Nun zum Code:
Mit ein bischen naiver Logik (bin wahrlich keine VBA leuchte) habe ich dann den Code logisch fortgesetzt
Private Sub ComboBox1_Click()
If ComboBox1.ListIndex <> 0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 1)
TextBox2 = Cells(ComboBox1.ListIndex + 1, 2)
TextBox3 = Cells(ComboBox1.ListIndex + 1, 3)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 4) 'diesen habe ich eingefügt
Else
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = "" 'dann diesen
End If
End Sub
Private Sub CommandButton1_Click()
If ComboBox1.ListIndex > 0 Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = "" 'hier das Gleiche
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 = [A65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
Cells(xZeile, 1) = TextBox1
Cells(xZeile, 2) = TextBox2
Cells(xZeile, 3) = TextBox3
Cells(xZeile, 4) = TextBox4 'hier auch
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = "" '!!!!!!!ACHTUNG MUßT DU NOCH EINFÜGEN!!!!!!!
Columns("A:D").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ 'hier mußte ich die Colums logischer Weise bis D erweitern.
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub
Den Rest des Codes konnte so bleiben.
gruss Thorsten