Könnten Sie bitte mal sagen, wohin soll ich diesen Code genau einsetzen?
Ich habe versucht, diesen Code so einzusetzen. Aber, es funktioniert bischer nicht.
Excel schreibt "Compile error: Duplicate declaration in current scope", wenn ich den Knopf "hinzufügen" drücke.
Und die Linie "Private Sub CommandButton1_Click()" wird gelb markiert.
Private Sub CommandButton1_Click()
Dim l&
With Worksheets("Blatt2")
l = .Range("B2").End(xlDown).Row + 1
.Cells(l, "C").Value = TextBox1
.Cells(l, "D").Value = TextBox8
.Cells(l, "E").Value = TextBox2
.Cells(l, "F").Value = TextBox3
.Cells(l, "G").Value = TextBox4
.Cells(l, "H").Value = ComboBox2
.Cells(l, "I").Value = ComboBox3
.Cells(l, "J").Value = TextBox5
.Cells(l, "K").Value = TextBox6
.Cells(l, "L").Value = TextBox7
End With
Dim zn1, zn2, zn3, zn4, zn5, zn6, zn7, zn8, zn9, zn10, l, adr
l = Range("B2").End(xlDown).Row
zn1 = TextBox1.Value
zn2 = TextBox8.Value
zn3 = TextBox2.Value
zn4 = TextBox3.Value
zn5 = TextBox4.Value
zn6 = ComboBox2.Value
zn7 = ComboBox3.Value
zn8 = TextBox5.Value
zn9 = TextBox6.Value
zn10 = TextBox7.Value
l = l + 1
adr = "C" & l
Range(adr).Value = zn1
adr = "D" & l
Range(adr).Value = zn2
adr = "E" & l
Range(adr).Value = zn3
adr = "F" & l
Range(adr).Value = zn4
adr = "G" & l
Range(adr).Value = zn5
adr = "H" & l
Range(adr).Value = zn6
adr = "I" & l
Range(adr).Value = zn7
adr = "J" & l
Range(adr).Value = zn8
adr = "K" & l
Range(adr).Value = zn9
adr = "L" & l
Range(adr).Value = zn10
End Sub
********//////******
Private Sub CommandButton2_Click()
UserForm3.Hide
End Sub
*****************////*******
Private Sub CommandButton3_Click()
Me.TextBox1.Value = " "
Me.TextBox2.Value = " "
Me.TextBox3.Value = " "
Me.TextBox4.Value = " "
Me.TextBox5.Value = " "
Me.TextBox6.Value = " "
Me.TextBox7.Value = " "
Me.TextBox8.Value = " "
Me.ComboBox2.Value = " "
Me.ComboBox3.Value = " "
End Sub
***********//////
Private Sub UserForm_Activate()
Me.ComboBox2.Clear
Me.ComboBox2.AddItem "pdf"
Me.ComboBox2.AddItem "JPEG"
Me.ComboBox2.AddItem "MP3"
Me.ComboBox2.AddItem "JPG"
Me.ComboBox2.AddItem "DOC"
Me.ComboBox2.AddItem "DOCX"
Me.ComboBox2.AddItem "XLS"
Me.ComboBox2.AddItem "XLSX"
Me.ComboBox2.AddItem "ZIP"
Me.ComboBox2.AddItem "RAR"
Me.ComboBox2.AddItem "PNG"
End Sub
|