ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating a ComboBox (https://www.excelbanter.com/excel-programming/325653-populating-combobox.html)

DirInfo

Populating a ComboBox
 
I have two questions. 1. i need to populate 10 comboboxes with the same
items. how do i do that without just using additem for each combobox for
each item?

2. When the excel sheet is opened i want the comboboxes to be automatically
populate (rather than having to run the macro each time i open the file,
currently when i open the workbook the comboboxes are blank until i run the
macro) if i use the worksheet_activate i have to leave the sheet and then go
back to it in order for it to run. is there a workbook_activate?

Thanks!

Tom Ogilvy

Populating a ComboBox
 
put the items in an array, assign the array to the list of each combobox.
v = Range("A1:A10")
for i = 1 to 10
activesheet.OleObjects("Combobox" & i)Object.List = v
Next

--
Regards,
Tom Ogilvy

"DirInfo" wrote in message
...
I have two questions. 1. i need to populate 10 comboboxes with the same
items. how do i do that without just using additem for each combobox for
each item?

2. When the excel sheet is opened i want the comboboxes to be

automatically
populate (rather than having to run the macro each time i open the file,
currently when i open the workbook the comboboxes are blank until i run

the
macro) if i use the worksheet_activate i have to leave the sheet and then

go
back to it in order for it to run. is there a workbook_activate?

Thanks!





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

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