ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to populate a combobox with the name of all the sheets in work (https://www.excelbanter.com/excel-programming/325463-how-populate-combobox-name-all-sheets-work.html)

Gordon[_2_]

How to populate a combobox with the name of all the sheets in work
 
Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon

Tom Ogilvy

How to populate a combobox with the name of all the sheets in work
 
for each sh in thisworkbook.worksheets
listbox1.AddItem sh.name
Next

--
Regards,
Tom Ogilvy

"Gordon" wrote in message
...
Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon




anonymousA

How to populate a combobox with the name of all the sheets inwork
 
Hi,

for each sh in activeworkbook.sheets
me.combobox1.additem sh.name
next




Gordon a écrit :
Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon


jai

How to populate a combobox with the name of all the sheets in
 
Hi,
I too am struggling with a similar problem. I have created a form that is
required to pop up and ask for user input on the particular field to use for
some processing. Rather than have the user type in a field name and then
vaildate it, I would like to launch a user form with a combo box in which the
list of fields is pre-loaded using the combobox.AddItem method and then allow
the user to choose one of them.

At what point can I populate the combo box list? The combo box appears to
"get live" the moment the form initialization takes place and so the list add
item does not happen before the combo box comes to life. How do I do this?

I saw an example using calls to a dynamic library using cbo.AddItem.
Could this be elaborated upon please ?

Many thanks

Jai

"anonymousA" wrote:

Hi,

for each sh in activeworkbook.sheets
me.combobox1.additem sh.name
next




Gordon a écrit :
Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon



Richard Buttrey

How to populate a combobox with the name of all the sheets in
 
Put your .addItem...... code in the Activate event of the form.

Alternatively if you have the items in a range of cells in the
workbook, you could set the RowSource property of the combo box to
point to the list. This avoids having to update the VBA code whenever
you have a new item.

HTH


On Sat, 29 Oct 2005 10:30:03 -0700, Jai
wrote:

Hi,
I too am struggling with a similar problem. I have created a form that is
required to pop up and ask for user input on the particular field to use for
some processing. Rather than have the user type in a field name and then
vaildate it, I would like to launch a user form with a combo box in which the
list of fields is pre-loaded using the combobox.AddItem method and then allow
the user to choose one of them.

At what point can I populate the combo box list? The combo box appears to
"get live" the moment the form initialization takes place and so the list add
item does not happen before the combo box comes to life. How do I do this?

I saw an example using calls to a dynamic library using cbo.AddItem.
Could this be elaborated upon please ?

Many thanks

Jai

"anonymousA" wrote:

Hi,

for each sh in activeworkbook.sheets
me.combobox1.additem sh.name
next




Gordon a écrit :
Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon



__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________

jai

How to populate a combobox with the name of all the sheets in work
 
Hi Gordon,
Thanks. Iwas putting the code in the Initialize event and got stuck. I
have tried the row source route earlier, but this time the list items are
coming from different workbooks and so this may not be so elegant though I am
sure it will work.

Thanks once again.

"Gordon" wrote:

Hi,

I'm struggling with this one. Can anyone help me.

Thanks
Gordon



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

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