View Single Post
 
Old 04-23-2018, 02:20 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Had no idea how to alpha sort the dictionary keys.
My buddy 'Google' lead me to this which seems to do the trick.

Replace
Code:
'populate combobox
cboFYList.List = Application.Transpose(dic.keys)
with
Code:
  ' Sort The Unique Values
    Uniques = dic.keys
    With CreateObject("System.Collections.ArrayList")
        For X = LBound(Uniques) To UBound(Uniques)
            .Add Uniques(X)
        Next
        .Sort
        Sorted = .ToArray
    End With
  
  ' Populate Combo with Sorted Uniques
  cboFYList.List = Sorted
You'll also need to declare the additional variables near the beginning along with the other Dim statements
Code:
Dim X As Integer, Uniques As Variant, Sorted As Variant
Reply With Quote