Die Datei https://www.herber.de/bbs/user/101088.xls wurde aus Datenschutzgründen gelöscht
Option Explicit
Private Sub UserForm_Activate()
Call FillMeUp
End Sub
Private Sub FillMeUp()
Dim objSortedList As Object
Dim objArrayList As Object
Dim vntArray As Variant
Dim lngIndex As Long
On Error GoTo Fin
Set objSortedList = CreateObject("System.Collections.SortedList")
Set objArrayList = CreateObject("System.Collections.ArrayList")
With ThisWorkbook.Worksheets("Tabelle2")
vntArray = .Range("D2:D" & .Cells(.Rows.Count, 4).End(xlUp).Row)
End With
For lngIndex = 1 To UBound(vntArray)
If vntArray(lngIndex, 1) <> "" Then
objSortedList(vntArray(lngIndex, 1)) = ""
End If
Next lngIndex
objArrayList.AddRange objSortedList.Keys
ComboBox3.List = objArrayList.ToArray
Fin:
If Err.Number <> 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
Set objSortedList = Nothing
Set objArrayList = Nothing
End Sub
Servus
Die Datei https://www.herber.de/bbs/user/101088.xls wurde aus Datenschutzgründen gelöscht
Option Explicit
Private Sub UserForm_Activate()
Call FillMeUp
End Sub
Private Sub FillMeUp()
Dim objSortedList As Object
Dim objArrayList As Object
Dim vntArray As Variant
Dim lngIndex As Long
On Error GoTo Fin
Set objSortedList = CreateObject("System.Collections.SortedList")
Set objArrayList = CreateObject("System.Collections.ArrayList")
With ThisWorkbook.Worksheets("Tabelle2")
vntArray = .Range("D2:D" & .Cells(.Rows.Count, 4).End(xlUp).Row)
End With
For lngIndex = 1 To UBound(vntArray)
If vntArray(lngIndex, 1) <> "" Then
objSortedList(vntArray(lngIndex, 1)) = ""
End If
Next lngIndex
objArrayList.AddRange objSortedList.Keys
ComboBox3.List = objArrayList.ToArray
Fin:
If Err.Number <> 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
Set objSortedList = Nothing
Set objArrayList = Nothing
End Sub
Servus