返回列表 上一主題 發帖

兩組數值去除重複的資料後排序

回復 1# henry860608


   


Sub test()
    Dim arr   As Object, brr As Variant
    Set arr = CreateObject("System.Collections.ArrayList")
    brr = Range("A1:B" & Cells(Rows.Count, "A").End(xlUp).Row)
    For Each n In brr
        If n <> vbNullString And Not arr.contains(n) Then arr.Add (n)
    Next
    arr.Sort
    Range("c1:c" & arr.Count) = Application.Transpose(arr.toarray)
End Sub

TOP

回復 8# Andy2483


例如activex combobox
  Sheets("工作表1").ComboBox1.List = arr.toarray
    Sheets("工作表1").ComboBox1.ListIndex = 0

   

TOP

        靜思自在 : 盡多少本份,就得多少本事。
返回列表 上一主題