Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to create one single combobox list by combining values from 2 separate ranges in a worksheet.
This code kinda works. Here is my data:
The resulting list that shows in the combobox is
This is just a representation of what is shown ... 1st value is active, 2nd value an empty value and the 3rd value is really all I'm looking for, 84992.
What I am looking for help doing:
1) the combobox list should only contain numbers found in those two columns (no balnks, no headers)
2) eliminate any duplicates between the two columns (there are no duplicates in the individual columns)
3) autopopulate the combobox value with the first value in the list.
4) If there is only one value in the list, disable the combobox (locked vs enabled so that it doesn't get greyed out)
Any support will be greatly appreciated.
Code:
With ws_vh
lrow_a = .Cells(.Rows.Count, "L").End(xlUp).Row
lrow_p = .Cells(.Rows.Count, "M").End(xlUp).Row
For Each Rng In Array(.Range("L2:L" & lrow_a), .Range("M2:M" & lrow_p))
For Each cll In Rng
cb_mri.AddItem cll.Value
Next cll
Next Rng
End With
This code kinda works. Here is my data:
Book1 | ||||
---|---|---|---|---|
L | M | |||
1 | ACTIVE | PASSIVE | ||
2 | 84992 | |||
VAR_HOLD |
The resulting list that shows in the combobox is
Book1 | |||
---|---|---|---|
P | |||
9 | ACTIVE | ||
10 | |||
11 | 84992 | ||
VAR_HOLD |
This is just a representation of what is shown ... 1st value is active, 2nd value an empty value and the 3rd value is really all I'm looking for, 84992.
What I am looking for help doing:
1) the combobox list should only contain numbers found in those two columns (no balnks, no headers)
2) eliminate any duplicates between the two columns (there are no duplicates in the individual columns)
3) autopopulate the combobox value with the first value in the list.
4) If there is only one value in the list, disable the combobox (locked vs enabled so that it doesn't get greyed out)
Any support will be greatly appreciated.