ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 6,159
- Office Version
- 2024
- Platform
- Windows
Currently the code populates the 3 Textboxes with values from my sheet.
All entries are loaded multiple times as opposed to the one time in each Textbox.
See attached images
If there are 27 values of 2 BUTTON KEY & 11 values of 3 BUTTON KEY i only need to see 1 of each not all of them
Can the existing code be edited so once a value is taken care of then there is no need to load another of the same value.
Thanks
All entries are loaded multiple times as opposed to the one time in each Textbox.
See attached images
If there are 27 values of 2 BUTTON KEY & 11 values of 3 BUTTON KEY i only need to see 1 of each not all of them
Can the existing code be edited so once a value is taken care of then there is no need to load another of the same value.
Thanks
Rich (BB code):
Private Sub UserForm_Activate()
Dim dic1 As Object, dic2 As Object, dic3 As Object
Dim i As Long
Set dic1 = CreateObject("Scripting.Dictionary")
Set dic2 = CreateObject("Scripting.Dictionary")
Set dic3 = CreateObject("Scripting.Dictionary")
a = Range("A1:G" & Range("D" & Rows.Count).End(3).Row).Value
ListBox1.ColumnCount = 7
For i = 2 To UBound(a, 1)
dic1(Range("D" & i).Value) = Empty
dic2(Range("F" & i).Value) = Empty
dic3(Range("G" & i).Value) = Empty
Next
ComboBox1.List = dic1.Keys
ComboBox2.List = dic2.Keys
ComboBox3.List = dic3.Keys
With Me.ListBox1
.ColumnWidths = "190;100;140;140;100;150;150"
.Width = 975
End With
Dim rngData As Range
Set rngData = Worksheets("DATABASE").Range("D6:D1000")
Me.ComboBox1.List = Evaluate("SORT(DATABASE!" & rngData.Address & ")")
Set rngData = Worksheets("DATABASE").Range("F6:F1000")
Me.ComboBox2.List = Evaluate("SORT(DATABASE!" & rngData.Address & ")")
Set rngData = Worksheets("DATABASE").Range("G6:G1000")
Me.ComboBox3.List = Evaluate("SORT(DATABASE!" & rngData.Address & ")")
End Sub