Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Populating List box with tab/worksheet names

Is there a way to populate a list box embedded in a worksheet with the names
I've assigned to the worksheets/tabs? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating List box with tab/worksheet names


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Populating List box with tab/worksheet names

Thanks, I will try that!

"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


  #4   Report Post  
Posted to microsoft.public.excel.programming
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Populating List box with tab/worksheet names

Sorry, just thought of one more related question. How would I handle the
need to populate the list box with only certain sheet names? Have the code
put the names in a cell range and then link the list box to just the part of
the range I needed? Thanks!

"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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating List box with tab/worksheet names


Firstly the Me operator referes to the object and can only be used in
the object so if your sheet is called Sheet1 then you have to use the
code in sheet1 code module, here's how to use it in your method, change
activesheet to be the name of the sheet you are working with:

Sub Auto_Open()

Dim Sh As Worksheet
For Each Sh In Sheets
If Sh.name = "Sheet1" or Sh.name ="Mysheet" Then
else
Activesheet.RegionSelect.AddItem (Sh.Name) ' RegionSelect is the name
of the list
box embeded in the sheet
end if
Next Sh
Application.ScreenUpdating = False
Application.Run "Format"
End Sub

as for the rest of your question feel free to join our forum where you
can make a post and upload a workbook where we will be able to help you
further!


--
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

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
MAKE A LIST OF NAMES FROM REPEATED NAMES IN THE SAME WORKSHEET r.kordahi Excel Discussion (Misc queries) 2 January 3rd 09 08:10 AM
Trying to list tab/worksheet names in a summary worksheet Mich Excel Discussion (Misc queries) 1 February 7th 08 02:07 AM
Created list of worksheet names but need list to be hyperlinked to maijiuli Excel Programming 6 September 10th 07 06:44 PM
Populating worksheet via a drop down list ! kuansheng Excel Worksheet Functions 4 February 14th 06 05:48 AM
Populating Userform ComboBox with worksheet names in XL2003 MAWII Excel Programming 0 August 9th 05 09:07 PM


All times are GMT +1. The time now is 04:12 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"