kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
This is how I am loading one of my comboboxes. But I am anticipating something that I want to avoid in the future.
A situation where I try selecting a product that has already been selected in one of the product comboboxes.
So the category comboboxes are named cat1 to cat10 and the product comboboxes are also from prod1 to prod10
A category has series of products assigned to it. Which means that the category comboboxes can have same category repeating itself like I have the multiple x in this example.
But I don’t want same products appearing in the product comboboxes. Since I don’t really know which of the comboboxes will be having the product that I want to avoid its duplication, it is giving me some headache here and I need some help with it.
Thanks in advance
A situation where I try selecting a product that has already been selected in one of the product comboboxes.
So the category comboboxes are named cat1 to cat10 and the product comboboxes are also from prod1 to prod10
A category has series of products assigned to it. Which means that the category comboboxes can have same category repeating itself like I have the multiple x in this example.
But I don’t want same products appearing in the product comboboxes. Since I don’t really know which of the comboboxes will be having the product that I want to avoid its duplication, it is giving me some headache here and I need some help with it.
Code:
Private Sub cat1_Change()
If Len(cat1) Then
prod1.Enabled = True
Else
prod1.Enabled = False
End If
Dim e_prod As Range
prod1.Clear
For Each e_prod In ThisWorkbook.Names("PRODUCT_LIST").RefersToRange.Columns(1).Cells
If e_prod.Offset(, 1) = cat1 Then
prod1.AddItem e_prod.Value
End If
Next e_prod
End Sub
Thanks in advance