Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate cell values with sheet names Bob Kilmer Excel Programming 0 August 13th 04 06:30 PM
Populate cell values with sheet names Oli Oshiz Excel Programming 0 August 13th 04 06:24 PM
Populate a combobox Rory[_3_] Excel Programming 2 June 9th 04 04:20 PM
Populate combobox with visable rows only max Excel Programming 1 February 17th 04 02:27 AM
Populating sheet names in combobox Todd Huttenstine[_2_] Excel Programming 3 December 21st 03 12:11 AM


All times are GMT +1. The time now is 04:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"