populate combobox with sheet names

D

David Goodall

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
 
D

David Goodall

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
 
D

Dave Peterson

I used something like this and it worked ok:


Private Sub CommandButton1_Click()
Worksheets.Add
Me.CB1.AddItem ActiveSheet.Name
End Sub
 
Top