AW: Werte aus Listbox mit MultiSelect
21.01.2005 14:43:40
Peter
Hallo,
mußt Du jedoch noch Deinen Bedürfnissen anpassen.
Peter
Option Explicit
Private Sub cmdInsert_Click()
Dim arrValues() As Variant
Dim intLastRow As Integer, intRow As Integer, intCol As Integer, intRowU As Integer
lstMultiCol.Clear
intLastRow = Worksheets(1).Cells(Rows.Count, 1).End(xlUp).Row
For intRow = 1 To intLastRow
If Not IsEmpty(Worksheets(1).Cells(intRow, 1)) Then
ReDim Preserve arrValues(0 To 4, 0 To intRowU) 'anpassen
arrValues(0, intRowU) = Worksheets(1).Cells(intRow, 1)
arrValues(1, intRowU) = Worksheets(1).Cells(intRow, 2)
arrValues(2, intRowU) = Worksheets(1).Cells(intRow, 3)
arrValues(3, intRowU) = Worksheets(1).Cells(intRow, 4) 'anpassen
arrValues(4, intRowU) = Worksheets(1).Cells(intRow, 5) 'anpassen
intRowU = intRowU + 1
End If
Next intRow
lstMultiCol.Column = arrValues
End Sub
Private Sub cmdWeiter_Click()
Unload Me
End Sub
Private Sub lstMultiCol_Click()
'Einträge aus mehrspaltiger Listbox in Tabelle
Dim i%, iRow%
iRow = Cells(Rows.Count, 5).End(xlUp).Row + 1
For i = 1 To 3
Cells(iRow, 4 + i) = Worksheets(1).Cells(lstMultiCol.ListIndex + 2, i)
Next i
End Sub