Gruppe
Dialog
Problem
Wie kann ich doppelte Einträge in einer UserForm-ListBox löschen?
ClassModule: frmDoppelte
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdDoppelte_Click()
Dim arr() As String
Dim var As Variant
Dim iCounter As Integer, iItem As Integer
ReDim Preserve arr(0)
arr(0) = lstDoppelte.List(0)
For iCounter = 1 To 11
var = Application.Match(lstDoppelte.List(iCounter), arr, 0)
If IsError(var) Then
iItem = iItem + 1
ReDim Preserve arr(iItem)
arr(iItem) = lstDoppelte.List(iCounter)
End If
Next iCounter
lstDoppelte.List = arr
End Sub
Private Sub UserForm_Initialize()
Dim iCounter As Integer
For iCounter = 1 To 12
lstDoppelte.AddItem Format(Date + iCounter, "dddd")
Next iCounter
End Sub
StandardModule: basMain
Sub CallForm()
frmDoppelte.Show
End Sub