Hallo Juergen,
hier ein Beispiel, man braucht dazu eine UserForm mit CommandButton1 und ListBox1. Eigenschafft Selected(Index) returns eine Item aus einem Array, das die Information enthaelt, ob Item mit Index in der ListBox ausgewaehlt ist ;-). Also es gibt zwei Arrays, eine enthaelt die Items (hier die Staedte) und die zweite enthaelt die Information, ob die Item ausgewaehlt ist. Selected ist also auch eine Array, das die selbe Anzahl an Rows wie Array mit den Items hat. Siehe besser den Help dazu (Selected).
Koenntest Du mindestens etwas verstehen :-))) ? Gruss Dan, CZ.
Option Explicit
Private Sub CommandButton1_Click()
' Selected Property Returns or sets the selection state of items in a ListBox
Dim intItem As Integer
With Me.ListBox1
For intItem = .ListCount - 1 To 0 Step -1
If (.Selected(intItem) = True) Then .RemoveItem (intItem)
Next intItem
End With
End Sub
Private Sub UserForm_Initialize()
' Note If you use the MultiSelect property to create a ListBox that allows multiple selections,
' the Selected property of the ListBox (rather than the ListIndex property) identifies the selected rows
With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.AddItem "Berlin"
.AddItem "Muenchen"
.AddItem "Stuttart"
.AddItem "Hanoover"
.AddItem "Hamburg"
End With
End Sub