ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using portion of larger list to populate combo box (https://www.excelbanter.com/excel-programming/358118-using-portion-larger-list-populate-combo-box.html)

ll

using portion of larger list to populate combo box
 
Is there a way to use a "portion" of a larger range list in excel, to
populate a combo box? I would want to be able to input data from a
form, back to that row, and I need to find a way to get the row number
(using the partial list to populate the combo box).
Would there be a way to use a count or index in order to provide an
accurate row count?

Thanks


Tom Ogilvy

using portion of larger list to populate combo box
 
Make a two column list in your combobox, but only display one column

With Userform1.Combobox1
.Columncount = 2
for each cell in Range("A1:A100")
if cell.Value 10 then
.AddItem cell.offset(0,1)
.List(.Listcount-1,1) = cell.row ' or cell.Address
end if
Next
End With


then

With Userform1.Combobox1
set rng = worksheets("Sheet1").Cells(.list(.listIndex,1),"B" )
end with

when you want to react to the selection in the list.

--
Regards,
Tom Ogilvy





"ll" wrote:

Is there a way to use a "portion" of a larger range list in excel, to
populate a combo box? I would want to be able to input data from a
form, back to that row, and I need to find a way to get the row number
(using the partial list to populate the combo box).
Would there be a way to use a count or index in order to provide an
accurate row count?

Thanks




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

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