I'm trying to pull all unique values from a specific column (starting in D2) from worksheet "RawData" and push it to a combobox ("ComboBoxManager")and have gotten it thus far (see code below) but i'd also like to have it sorted from A to Z but am having trouble, can anyone help?
Code:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim LastRow&, cell As Range
With Worksheets("RawData")
On Error Resume Next
.ShowAllData
Err.Clear
LastRow = .Cells(Rows.Count, 2).End(xlUp).Row
.Range("D1:D" & LastRow).AdvancedFilter Action:=xlFilterInPlace, Unique:=True
ComboBoxManager.Clear
For Each cell In .Range("D2:D" & LastRow).SpecialCells(12)
ComboBoxManager.AddItem cell.Value
Next cell
On Error Resume Next
.ShowAllData
Err.Clear
End With
Application.ScreenUpdating = True
End Sub