Code:
Option
Explicit
Private
Sub
ComboBox1_Click()
If
ComboBox1.ListIndex <> 0
Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 2)
TextBox2 = Cells(ComboBox1.ListIndex + 1, 3)
TextBox3 = Cells(ComboBox1.ListIndex + 1, 4)
TextBox4 = Cells(ComboBox1.ListIndex + 1, 5)
TextBox5 = Cells(ComboBox1.ListIndex + 1, 6)
ComboBox2 = Cells(ComboBox1.ListIndex + 1, 7)
ComboBox3 = Cells(ComboBox1.ListIndex + 1, 8)
ComboBox4 = Cells(ComboBox1.ListIndex + 1, 9)
ComboBox5 = Cells(ComboBox1.ListIndex + 1, 10)
ComboBox6 = Cells(ComboBox1.ListIndex + 1, 11)
Else
TextBox1 =
""
TextBox2 =
""
TextBox3 =
""
TextBox4 =
""
TextBox5 =
""
ComboBox2 =
""
ComboBox3 =
""
ComboBox4 =
""
ComboBox5 =
""
ComboBox6 =
""
End
If
End
Sub
Private
Sub
CommandButton1_Click()
If
ComboBox1.ListIndex > 0
Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 =
""
TextBox2 =
""
TextBox3 =
""
TextBox4 =
""
TextBox5 =
""
ComboBox2 =
""
ComboBox3 =
""
ComboBox4 =
""
ComboBox5 =
""
ComboBox6 =
""
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 = [B65536].
End
(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End
If
Cells(xZeile, 2) = TextBox1
Cells(xZeile, 3) = TextBox2
Cells(xZeile, 4) = TextBox3
Cells(xZeile, 5) = TextBox4
Cells(xZeile, 6) = TextBox5
Cells(xZeile, 7) = ComboBox2
Cells(xZeile, 8) = ComboBox3
Cells(xZeile, 9) = ComboBox4
Cells(xZeile, 10) = ComboBox5
Cells(xZeile, 11) = ComboBox6
TextBox1 =
""
TextBox2 =
""
TextBox3 =
""
TextBox4 =
""
TextBox5 =
""
ComboBox2 =
""
ComboBox3 =
""
ComboBox4 =
""
ComboBox5 =
""
ComboBox6 =
""
UserForm_Initialize
End
Sub
Private
Sub
CommandButton3_Click()
Unload
Me
End
Sub
Private
Sub
Frame1_Click()
End
Sub
Private
Sub
Frame4_Click()
End
Sub
Private
Sub
ListBox1_Click()
End
Sub
Private
Sub
ListBox3_Click()
End
Sub
Private
Sub
MultiPage1_Change()
End
Sub
Private
Sub
TextBox3_Change()
End
Sub
Private
Sub
UserForm_Initialize()
Dim
aRow, i
As
Variant
Application.EnableEvents =
False
ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear
ComboBox4.Clear
ComboBox5.Clear
ComboBox6.Clear
aRow = [B65536].
End
(xlUp).Row
ComboBox1.AddItem
"neue Kunde hinzufügen"
With
Me
.ComboBox2
.AddItem
""
.AddItem
"12"
.AddItem
"24"
.AddItem
"36"
.AddItem
"48"
.AddItem
"60"
.ListIndex =
"0"
End
With
With
Me
.ComboBox3
.AddItem
""
.AddItem
"1"
.AddItem
"2"
.AddItem
"3"
.AddItem
"4"
.AddItem
"5"
.ListIndex =
"0"
End
With
With
Me
.ComboBox4
.AddItem
""
.AddItem
"Ja"
.AddItem
"Nein"
.ListIndex =
"0"
End
With
With
Me
.ComboBox5
.AddItem
""
.AddItem
"Ja"
.AddItem
"Nein"
.ListIndex =
"0"
End
With
With
Me
.ComboBox6
.AddItem
""
.AddItem
"Ingo"
.AddItem
"Jemand anderes"
.ListIndex =
"0"
End
With
For
i = 2
To
aRow
ComboBox1.AddItem Cells(i, 2)
Next
i
ComboBox1.ListIndex = 0
ComboBox2.ListIndex = 0
ComboBox3.ListIndex = 0
ComboBox4.ListIndex = 0
ComboBox5.ListIndex = 0
ComboBox6.ListIndex = 0
Application.EnableEvents =
True
ListBox1.ColumnCount = 10
Dim
arr
arr = Sheets(
"Tabelle1"
).Range(
"B2:K500000"
)
ListBox1.List = arr
End
Sub