Option Explicit Private Sub UserForm_Initialize() Dim a As Object Dim t As ListObject Dim rr As Range, r As Range Dim s As String Set a = CreateObject("system.collections.arraylist") Set t = Worksheets("Sheet1").ListObjects("Table1") With t.Range .AutoFilter 1, "<>" On Error Resume Next Set rr = Intersect(.Offset(1), .Columns(1).SpecialCells(xlCellTypeVisible)) On Error GoTo 0 If Not rr Is Nothing Then For Each r In rr s = CStr(r.Value) If Not a.contains(s) Then a.Add s End If Next a.Sort ComboBox1.List = a.toarray End If End With End Sub
マナ




Reply With Quote