View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Nick O[_2_] Nick O[_2_] is offline
external usenet poster
 
Posts: 8
Default Populating List box with tab/worksheet names

Hit a snag. It's throwing me an error when I use "Me" and when I remove that
it gives me an "object required" error. here's the code:

Sub Auto_Open()

Dim Sh As Worksheet
For Each Sh In Sheets
Me.RegionSelect.AddItem (Sh.Name) ' RegionSelect is the name of the list
box embeded in the sheet
Next Sh
Application.ScreenUpdating = False
Application.Run "Format"
End Sub

"The Code Cage Team" wrote:


Try this, when you activate the worksheet the names are populated:

Private Sub Worksheet_Activate()
Dim Sh As Worksheet
For Each Sh In Sheets
Me.ListBox1.AddItem (Sh.Name)
Next Sh
End Sub


--
The Code Cage Team

Regards,
The Code Cage Team
www.thecodecage.com
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=26045