Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
populate combobox with sheet names
Hello All
I'm trying to find a way to populate a combobox with the names of Worksheets from one Workbook. I'm ok just adding sheets that already exist but I will need to add more sheets to the workbook and the combobox needs to update automatically. Each worksheet will have a unique name not just Sheet1, etc. Any help is greatly appreciated. Regards David |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
populate combobox with sheet names
Apologies - I've partly solved my problem with
Dim mysheetlist As Worksheet For Each mysheetlist In worksheets Me.Cb1.AddItem mysheetlist.Name Next mysheetlist The only thing it doesn't do is update after I've added a new sheet. The sheets are added programmically from the same userform. Thanks David "David Goodall" wrote in message ... Hello All I'm trying to find a way to populate a combobox with the names of Worksheets from one Workbook. I'm ok just adding sheets that already exist but I will need to add more sheets to the workbook and the combobox needs to update automatically. Each worksheet will have a unique name not just Sheet1, etc. Any help is greatly appreciated. Regards David |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
populate combobox with sheet names
Couldn't you just add the new sheet name to the list when you add it.
David Goodall wrote: Apologies - I've partly solved my problem with Dim mysheetlist As Worksheet For Each mysheetlist In worksheets Me.Cb1.AddItem mysheetlist.Name Next mysheetlist The only thing it doesn't do is update after I've added a new sheet. The sheets are added programmically from the same userform. Thanks David "David Goodall" wrote in message ... Hello All I'm trying to find a way to populate a combobox with the names of Worksheets from one Workbook. I'm ok just adding sheets that already exist but I will need to add more sheets to the workbook and the combobox needs to update automatically. Each worksheet will have a unique name not just Sheet1, etc. Any help is greatly appreciated. Regards David -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
populate combobox with sheet names
I used something like this and it worked ok:
Private Sub CommandButton1_Click() Worksheets.Add Me.CB1.AddItem ActiveSheet.Name End Sub David Goodall wrote: Apologies - I've partly solved my problem with Dim mysheetlist As Worksheet For Each mysheetlist In worksheets Me.Cb1.AddItem mysheetlist.Name Next mysheetlist The only thing it doesn't do is update after I've added a new sheet. The sheets are added programmically from the same userform. Thanks David "David Goodall" wrote in message ... Hello All I'm trying to find a way to populate a combobox with the names of Worksheets from one Workbook. I'm ok just adding sheets that already exist but I will need to add more sheets to the workbook and the combobox needs to update automatically. Each worksheet will have a unique name not just Sheet1, etc. Any help is greatly appreciated. Regards David -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Populate cell values with sheet names | Excel Programming | |||
Populate cell values with sheet names | Excel Programming | |||
Populate a combobox | Excel Programming | |||
Populate combobox with visable rows only | Excel Programming | |||
Populating sheet names in combobox | Excel Programming |