ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate combobox (https://www.excelbanter.com/excel-programming/318713-populate-combobox.html)

Pat

Populate combobox
 
Anyone know what code is needed to populate a combobox?

On a sheet there is a column heading called "category" another heading
called "business name" I only want to populate the combobox from a
specified name within the category column. This would thereby only display
the business names for that particular category.

Many thanks if you can be of help.
Pat



Tom Ogilvy

Populate combobox
 
set rng = Range(Cells(1,1),Cells(rows.count,1).End(xlup))
for each cell in rng
if cell.Value = "Category1" then
userform1.Combobox1.AddItem cell.offset(0,1).Value
end if
Next

It might be faster to filter the data.


--
Regards,
Tom Ogilvy

"Pat" wrote in message
...
Anyone know what code is needed to populate a combobox?

On a sheet there is a column heading called "category" another heading
called "business name" I only want to populate the combobox from a
specified name within the category column. This would thereby only display
the business names for that particular category.

Many thanks if you can be of help.
Pat






All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com