Option
Explicit
Private
Sub
UserForm_Activate()
Me
.ListBox1.List = Tabelle1.Range(
"B2:F3"
).Value
Dim
avntValues
As
Variant
Dim
ialngIndex
As
Long
With
Tabelle1
avntValues = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).
End
(xlUp)).Value
End
With
ListBox1.ListStyle = fmListStyleOption
ListBox1.MultiSelect = fmMultiSelectMulti
Me
.ListBox2.List = Tabelle1.Range(
"B4:F15"
).Value
Dim
avntValues2
As
Variant
Dim
ialngIndex2
As
Long
With
Tabelle1
avntValues2 = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).
End
(xlUp)).Value
End
With
ListBox2.ListStyle = fmListStyleOption
ListBox2.MultiSelect = fmMultiSelectMulti
Me
.ListBox3.List = Tabelle1.Range(
"B16:F25"
).Value
Dim
avntValues3
As
Variant
Dim
ialngIndex3
As
Long
With
Tabelle1
avntValues3 = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).
End
(xlUp)).Value
End
With
ListBox3.ListStyle = fmListStyleOption
ListBox3.MultiSelect = fmMultiSelectMulti
End
Sub
Private
Sub
CommandButton1_Click()
ListBoxAuswahl ListBox1, _
ThisWorkbook(
"Neues_Angebot"
).Worksheets(
"Tabelle1"
).Range(
"B19"
)
End
Sub
Private
Sub
ListBoxAuswahl(DieListbox
As
MSForms.Listbox, _
StartZelle
As
Range)
Dim
vX()
As
Variant
, i
As
Long
, z
As
Long
, k
As
Integer
With
DieListbox
For
i = 0
To
.ListCount - 1
If
.Selected(i)
Then
z = z + 1
Next
i
If
z = 0
Then
Exit
Sub
ReDim
vX(1
To
z, 1
To
.ColumnCount)
z = 0
For
i = 0
To
.ListCount - 1
If
.Selected(i)
Then
z = z + 1
For
k = 0
To
.ColumnCount - 1
vX(z, k + 1) = .List(i, k)
Next
k
End
If
Next
i
End
With
With
StartZelle
Range(.Parent.Cells(StartZelle.row, StartZelle.Column), _
.Parent.Cells(StartZelle.row + z - 1, _
StartZelle.Column + DieListbox.ColumnCount - 1)).Value = vX
End
With
End
Sub