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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List box of worksheets on excel useform 1

Status
Not open for further replies.

SciBoy

Technical User
Mar 13, 2002
2
GB
Can Anyone help me I want to add code to a userform in excel so that a list box on it will display a list of all of the worksheets in an active workbook, Any ideas?
 
SciBoy
Try (adapting) this:

Private Sub UserForm_Initialize()
Dim iCount As Integer
For iCount = 1 To ThisWorkbook.Worksheets.Count
ListBox1.AddItem ThisWorkbook.Worksheets(iCount).Name
Next
End Sub

I've just learned today that by doing this it even lists the hidden sheet left over from my last reply to monk999 on hiding sheets.

I'm having a good day despite my cold having also discovered ms flexigrid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top