Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Populate Excel Userform with Sheet names

Hi,

I'm using this piece of code to populate an excel userform listbox with the
name of each worksheet in a workbook

i = 1
For Each ws In Worksheets
Worksheets.Select
Sheets(i).Activate
ListBox1.AddItem (ActiveSheet.Name)
i = i + 1
Next ws


Is there a better way I can do this as this visably activates each
sheet each time the listbox is repopulated.

Thanks

...pc


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Populate Excel Userform with Sheet names

PC

For Each ws In ActiveWorkbook.Worksheets
ListBox1.AddItem ws.Name
Next ws

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

PC wrote:
Hi,

I'm using this piece of code to populate an excel userform listbox
with the name of each worksheet in a workbook

i = 1
For Each ws In Worksheets
Worksheets.Select
Sheets(i).Activate
ListBox1.AddItem (ActiveSheet.Name)
i = i + 1
Next ws


Is there a better way I can do this as this visably activates each
sheet each time the listbox is repopulated.

Thanks

..pc



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populate Excel Userform with Sheet names


Hello PC,

Paste this code into your program.

I = 1
For Each ws In Worksheets
ComboBox1.AddItem (Sheets(I).Name)
I = I + 1
Next ws

Hope this helps,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=34586

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 combobox with sheet names David Goodall Excel Programming 3 September 12th 04 12:37 PM
populate combobox with sheet names David Goodall Excel Programming 0 September 12th 04 08:55 AM
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 combo box for Userform in Excel 2002 Myrna Rodriguez Excel Programming 5 May 7th 04 08:03 PM


All times are GMT +1. The time now is 03:14 AM.

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

About Us

"It's about Microsoft Excel"