ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating combobox from another combobox (https://www.excelbanter.com/excel-programming/309686-populating-combobox-another-combobox.html)

David Goodall

Populating combobox from another combobox
 
Hello
I've created, with help, a combobox that lists the sheets in a workbook. I
now want a second combobox to be populated from the contents of a specific
range from the sheet chosen in combobox 1. ie

combobox1 = company names (held in sheet)

combobox2 = above company - employee names held in range(A2:A30)

Again any help is greatly appreciated.

Thanks
David




Tom Ogilvy

Populating combobox from another combobox
 
use the click event of the first combobox

Private Sub Combobox1_Click()
Dim sName as String
if Combobox1.ListIndex < -1 then
sName = Combobox1.Value
Combobox2.RowSource = sName & "!A2:A30"
End if
End sub

--
Regards,
Tom Ogilvy

"David Goodall" wrote in message
...
Hello
I've created, with help, a combobox that lists the sheets in a workbook. I
now want a second combobox to be populated from the contents of a specific
range from the sheet chosen in combobox 1. ie

combobox1 = company names (held in sheet)

combobox2 = above company - employee names held in range(A2:A30)

Again any help is greatly appreciated.

Thanks
David







All times are GMT +1. The time now is 03:06 AM.

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