kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Hello world,
I want to do something very simple and cool but it seems a bit complicated to me atm.
So this is the code I have currently:
I want to place the “First Item” first.
But it’s not working.
What should I do to get it done?
Thanks in advance
I want to do something very simple and cool but it seems a bit complicated to me atm.
So this is the code I have currently:
Code:
Private Sub UserForm_Initialize()
Dim r As Range
Dim rng As Range
Dim lr As Long
Dim dic As Object
Dim sh As Object
ComboBox1.Clear
Set sh = Sheets("DATA")
Set dic = CreateObject("Scripting.Dictionary")
lr = sh.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = sh.Range("A1:A" & lr)
For Each r In rng
dic.Item(r.Value) = Empty
Next r
‘ComboBox1.AddItem "First Item"
ComboBox1.List = dic.keys
End Sub
I want to place the “First Item” first.
But it’s not working.
What should I do to get it done?
Thanks in advance