Hey there,
I've got something like this:
I need modification to this code:
It fills my combobox1 with unique employee names, but I would like it to also take into account company name definied by combobox2 and linked into F2 cell. So something like if F2 = "XYZ" then fill combobox1 with unique employee names in that company else fill names with "ZYX" company.
Any help is greatly appreciated. Thank you!
Crossposted at: https://www.excelforum.com/excel-programming-vba-macros/1249395-if-statement-in-combobox.html
I've got something like this:
I need modification to this code:
Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Private Sub Worksheet_Activate()
Dim a, e
a = Sheets("Sheet1").Cells(1).CurrentRegion.Columns(1).Offset(1).Value
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For Each e In a
If e <> "" Then .Item(e) = Empty
Next
Me.ComboBox1.List = .keys
End With
End Sub
</code>
It fills my combobox1 with unique employee names, but I would like it to also take into account company name definied by combobox2 and linked into F2 cell. So something like if F2 = "XYZ" then fill combobox1 with unique employee names in that company else fill names with "ZYX" company.
Any help is greatly appreciated. Thank you!
Crossposted at: https://www.excelforum.com/excel-programming-vba-macros/1249395-if-statement-in-combobox.html