sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,422
- Office Version
- 2016
- Platform
- Windows
I have a Combobox which is loaded with current staff names by this;
The box is then populated by the click of a Listbox item;
However, the Listbox is retrieving data from a large spreadsheet which may include details of retired staff, so is there a way I can get it to add 'Inactive Staff' to the Combobox items if the value from the Listbox isn't found? The Combobox is available for other functions so I don't want to simply add 'Inactive Staff' from the start.
I'm trying to find a way to add the item programmatically to avoid it throwing an error as the Combobox is set as TRUE for match required - if there is a simpler solution then I'm open to suggestions!
Code:
lRow = Sheets("Setup").Range("A" & Rows.Count).End(xlUp).Row
ComboLink1.List = Worksheets("Setup").Range("$A$2:$A$" & lRow).Value
The box is then populated by the click of a Listbox item;
Code:
ComboLink1.Value = ListBox1.Column(2)
However, the Listbox is retrieving data from a large spreadsheet which may include details of retired staff, so is there a way I can get it to add 'Inactive Staff' to the Combobox items if the value from the Listbox isn't found? The Combobox is available for other functions so I don't want to simply add 'Inactive Staff' from the start.
I'm trying to find a way to add the item programmatically to avoid it throwing an error as the Combobox is set as TRUE for match required - if there is a simpler solution then I'm open to suggestions!