Hi,
habe in einem Excel-Tabellenblatt eine Maske erstellt. Über ein Listenfeld können Personen ausgewählt (Nachname) und dann über Textfelder Daten eingetragen werden. Mein Problem - wenn ich meine Änderungen über den OK-Button in die Zellen übernehmen möchte, werden nur die Änderungen im Textfeld 3 übernommen. Im Textfeld 3 wird jeweils der Wert angezeigt, der im Kombinationsfeld ausgewählt ist, also der Nachname. Es wäre nett, wenn mal jemand über den Code drüber schaut und mir den Fehler rückmeldet.
Private Sub ListBox1_Click()
spalte = 3
zeile = (ListBox1.ListIndex + 2)
Me.TextBox3 = Worksheets(10).Cells(zeile, spalte)
Me.TextBox4 = Worksheets(10).Cells(zeile, spalte + 1)
Me.TextBox5 = Worksheets(10).Cells(zeile, spalte + 2)
Me.TextBox6 = Worksheets(10).Cells(zeile, spalte + 3)
Me.TextBox7 = Worksheets(10).Cells(zeile, spalte + 4)
Me.TextBox8 = Worksheets(10).Cells(zeile, spalte + 5)
Me.TextBox9 = Worksheets(10).Cells(zeile, spalte + 6)
Me.TextBox10 = Worksheets(10).Cells(zeile, spalte + 7)
Me.TextBox11 = Worksheets(10).Cells(zeile, spalte + 8)
Me.TextBox14 = Worksheets(10).Cells(zeile, spalte + 11)
Me.TextBox17 = Worksheets(10).Cells(zeile, spalte + 14)
Me.TextBox18 = Worksheets(10).Cells(zeile, spalte + 15)
Me.TextBox19 = Worksheets(10).Cells(zeile, spalte + 16)
Me.TextBox30 = Worksheets(10).Cells(zeile, spalte + 27)
Me.TextBox32 = Worksheets(10).Cells(zeile, spalte + 29)
Me.TextBox33 = Worksheets(10).Cells(zeile, spalte + 30)
Me.TextBox34 = Worksheets(10).Cells(zeile, spalte + 31)
Me.TextBox35 = Worksheets(10).Cells(zeile, spalte + 32)
Me.TextBox36 = Worksheets(10).Cells(zeile, spalte + 33)
Me.TextBox37 = Worksheets(10).Cells(zeile, spalte + 34)
Me.TextBox38 = Worksheets(10).Cells(zeile, spalte + 35)
Me.TextBox39 = Worksheets(10).Cells(zeile, spalte + 36)
Me.TextBox40 = Worksheets(10).Cells(zeile, spalte + 37)
Me.TextBox41 = Worksheets(10).Cells(zeile, spalte + 38)
Me.TextBox42 = Worksheets(10).Cells(zeile, spalte + 39)
Me.TextBox43 = Worksheets(10).Cells(zeile, spalte + 40)
Me.TextBox44 = Worksheets(10).Cells(zeile, spalte + 41)
End Sub
Private Sub CommandButton1_Click()
spalte = 3
zeile = (ListBox1.ListIndex + 2)
Worksheets(10).Cells(zeile, spalte) = Me.TextBox3
Worksheets(10).Cells(zeile, spalte + 1) = Me.TextBox4
Worksheets(10).Cells(zeile, spalte + 2) = Me.TextBox5
Worksheets(10).Cells(zeile, spalte + 3) = Me.TextBox6
Worksheets(10).Cells(zeile, spalte + 4) = Me.TextBox7
Worksheets(10).Cells(zeile, spalte + 5) = Me.TextBox8
Worksheets(10).Cells(zeile, spalte + 6) = Me.TextBox9
Worksheets(10).Cells(zeile, spalte + 7) = Me.TextBox10
Worksheets(10).Cells(zeile, spalte + 8) = Me.TextBox11
Worksheets(10).Cells(zeile, spalte + 11) = Me.TextBox14
Worksheets(10).Cells(zeile, spalte + 14) = Me.TextBox17
Worksheets(10).Cells(zeile, spalte + 15) = Me.TextBox18
Worksheets(10).Cells(zeile, spalte + 16) = Me.TextBox19
Worksheets(10).Cells(zeile, spalte + 27) = Me.TextBox30
Worksheets(10).Cells(zeile, spalte + 29) = Me.TextBox32
Worksheets(10).Cells(zeile, spalte + 30) = Me.TextBox33
Worksheets(10).Cells(zeile, spalte + 31) = Me.TextBox34
Worksheets(10).Cells(zeile, spalte + 32) = Me.TextBox35
Worksheets(10).Cells(zeile, spalte + 33) = Me.TextBox36
Worksheets(10).Cells(zeile, spalte + 34) = Me.TextBox37
Worksheets(10).Cells(zeile, spalte + 35) = Me.TextBox38
Worksheets(10).Cells(zeile, spalte + 36) = Me.TextBox39
Worksheets(10).Cells(zeile, spalte + 37) = Me.TextBox40
Worksheets(10).Cells(zeile, spalte + 38) = Me.TextBox41
Worksheets(10).Cells(zeile, spalte + 39) = Me.TextBox42
Worksheets(10).Cells(zeile, spalte + 40) = Me.TextBox43
Worksheets(10).Cells(zeile, spalte + 41) = Me.TextBox44
End Sub
Private Sub CommandButton2_Click()
Unload UserForm1
End Sub
|