Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Array containing sheet names? 2

Status
Not open for further replies.

ribsa3

Programmer
Jun 17, 2003
56
Hi

I wish to populate a combo-box with the names of all the sheets (Not the object name, but the object name's name - get it? ;) - Basically the text on the sheet tab.

Is there a nice system array I can use to retrieve this data most conveniently?

Kindly,

Bjoern Sandvik



--------------------------------------------------------------------
Do what you wish, as long as it harms no one. That includes yourself.
 
Try this:
Code:
Private Sub ComboBox1_DropButtonClick()
Dim ws As Worksheet
ComboBox1.Clear
For Each ws In ThisWorkbook.Worksheets
  ComboBox1.AddItem ws.Name
Next ws
End Sub
 
Hi,

I'm not sure what you mean about the objects names name, but if you simply want to get the names as they appear on the screen then do the following:

Code:
For Each l_worksheets In Worksheets
    
    ' add your code her to add it to the combo
    
    MsgBox (l_worksheets.Name)
Next l_worksheets

Hope this helps

Andrew
 
I knew it had to be easy ;) Thanks!



--------------------------------------------------------------------
Do what you wish, as long as it harms no one. That includes yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top