Forum Discussion
Anthony Smith
Sep 05, 2018Copper Contributor
How to Keep Leading Zeros in ComboBox
Hello,
The below code writes data to a combobox. Unfortunately, when it writes numbers with a leading zero, it doesn't keep the leading zeros. How do I adjust my code to maintain the leading zeros?
Private Sub ComboBox1_Change()
Dim r As Variant, cDic As Object
With Me.ComboBox2
.Clear
Set cDic = CreateObject("Scripting.Dictionary")
For Each r In Dic(Val(ComboBox1.Value))
If Not cDic.exists(r) Then
cDic.Add r, Nothing
.AddItem r
End If
Next r
End With
End Sub
Any help is appreciated!
Thanks.
No RepliesBe the first to reply