Private
Sub
CommandButton1_Click()
Dim
Litem
As
Long
, LbRows
As
Long
, LbCols
As
Long
Dim
bu
As
Boolean
Dim
Lbloop
As
Long
, Lbcopy
As
Long
Dim
m
As
Variant
LbRows = ListBox2.ListCount - 1
LbCols = ListBox2.ColumnCount - 1
For
Litem = 0
To
LbRows
If
ListBox2.Selected(Litem) =
True
Then
bu =
True
Exit
For
End
If
Next
If
bu =
True
Then
With
Sheets(
"Tabelle1"
).Cells(Rows.Count, 1).
End
(xlUp).Offset(1, 0)
For
Litem = 0
To
LbRows
If
ListBox2.Selected(Litem) =
True
Then
Lbcopy = Lbcopy + 1
For
Lbloop = 0
To
LbCols
.Cells(Lbcopy, Lbloop + 1) = ListBox2.List(Litem, Lbloop)
Next
Lbloop
End
If
Next
For
m = 0
To
LbCols
With
Sheets(
"Tabelle1"
).Cells(Rows.Count, 1).
End
(xlUp).Offset(0, m).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = 23
End
With
Next
End
With
Else
MsgBox
"Nothing chosen"
, vbCritical
End
If
MsgBox
"The Selected Data Are Copied."
, vbInformation
Sheets(
"Tabelle1"
).
Select
End
Sub