Add item to Combobox if no match found

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
I have a Combobox which is loaded with current staff names by this;

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!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,215,737
Messages
6,126,562
Members
449,318
Latest member
Son Raphon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top