Code für Userform ändern
21.03.2007 17:47:39
Andreas
Hallo Excelprofis!
Ich habe mit eine Excelmappe mit einer "Eingabemaske" über versch. Text-, Combo- und Checkboxen gebaut. Über einen Commandbutton werden die daten dann in das 2. Blatt übertragen.
Durch einen Tipp in diesem Forum habe ich jetzt zur Eingabe der Daten eine UserForm erstellt.
Die Text-, Combo- und Checkboxen haben die gleiche Bezeichnung wie bei meiner ersten "Eingabemaske".
Kann mir bitte Jemand sagen, wie mein Code für Commandbutton1 in der UserForm-Variante aussehen muß.
Option Explicit
Private Sub CommandButton1_Click()
Dim ws As Worksheet, r As Long
Set ws = Worksheets("Auswertung")
With ws
r = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
.Cells(r, 1) = r - 4
.Cells(r, 2) = TextBoxFirma.Value: TextBoxFirma.Value = ""
.Cells(r, 3) = IIf(CheckBoxHauptsitz.Value, "1", ""): CheckBoxHauptsitz.Value = False
.Cells(r, 4) = IIf(CheckBoxFiliale.Value, "1", ""): CheckBoxFiliale.Value = False
.Cells(r, 5) = ComboBoxAnrede.Value: ComboBoxAnrede.Value = ""
.Cells(r, 6) = TextBoxAnsprechpartnerName.Value: TextBoxAnsprechpartnerName.Value = ""
.Cells(r, 7) = TextBoxAnsprechpartnerVorname.Value: TextBoxAnsprechpartnerVorname.Value = "" _
_
_
.Cells(r, 8) = TextBoxZusatz.Value: TextBoxZusatz.Value = ""
.Cells(r, 9) = TextBoxPostfach.Value: TextBoxPostfach.Value = ""
.Cells(r, 10) = TextBoxAdresse.Value: TextBoxAdresse.Value = ""
.Cells(r, 11) = TextboxPLZ.Value: TextboxPLZ.Value = ""
.Cells(r, 12) = TextBoxStadt.Value: TextBoxStadt.Value = ""
.Cells(r, 13) = ComboBoxLand.Value: ComboBoxLand.Value = ""
.Cells(r, 14) = TextBoxTelefon.Value: TextBoxTelefon.Value = ""
.Cells(r, 15) = TextBoxFax.Value: TextBoxFax.Value = ""
.Cells(r, 16) = TextBoxMail.Value: TextBoxMail.Value = ""
.Cells(r, 17) = IIf(CheckBoxTag1.Value, "1", ""): CheckBoxTag1.Value = False
.Cells(r, 18) = IIf(CheckBoxTag2.Value, "1", ""): CheckBoxTag2.Value = False
.Cells(r, 19) = IIf(CheckBoxTag3.Value, "1", ""): CheckBoxTag3.Value = False
.Cells(r, 20) = IIf(CheckBoxTag4.Value, "1", ""): CheckBoxTag4.Value = False
.Cells(r, 21) = IIf(CheckBoxKategorie1.Value, "1", ""): CheckBoxKategorie1.Value = _
False
.Cells(r, 22) = IIf(CheckBoxKategorie2.Value, "1", ""): CheckBoxKategorie2.Value = _
False
.Cells(r, 23) = IIf(CheckBoxKategorie3.Value, "1", ""): CheckBoxKategorie3.Value = _
False
.Cells(r, 24) = IIf(CheckBoxKategorie4.Value, "1", ""): CheckBoxKategorie4.Value = _
False
.Cells(r, 25) = IIf(CheckBoxKategorie5.Value, "1", ""): CheckBoxKategorie5.Value = _
False
.Cells(r, 26) = IIf(CheckBoxKategorie6.Value, "1", ""): CheckBoxKategorie6.Value = _
False
.Cells(r, 27) = IIf(CheckBoxKategorie7.Value, "1", ""): CheckBoxKategorie7.Value = _
False
.Cells(r, 28) = IIf(CheckBoxKategorie8.Value, "1", ""): CheckBoxKategorie8.Value = _
False
.Cells(r, 29) = IIf(CheckBoxDeutsch.Value, "1", ""): CheckBoxDeutsch.Value = False
.Cells(r, 30) = IIf(CheckBoxItalienisch.Value, "1", ""): CheckBoxItalienisch.Value = _
False
.Cells(r, 31) = IIf(CheckBoxFranzösisch.Value, "1", ""): CheckBoxFranzösisch.Value = _
False
.Cells(r, 32) = IIf(CheckBoxAndereSprache.Value, "1", ""): CheckBoxAndereSprache.Value = _
_
_
False
End With
End Sub
Danke für die Hilfe!mfg Andreas