Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Loading combo box list

Greetings. I am loading a combo box list on the initialize event with code I
found here, and it works perfectly.

For Each sh In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem sh.Name
Next

However, there are two sheets, the last two that I don't want to show up in
the list. I can't find an easy way to keep these two sheets out. Any ideas?
Thank you.

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Loading combo box list

Ok, that was easy.

For Each sh In ActiveWorkbook.Sheets
If sh.Name < "BDMS" And sh.Name < "HELD" Then
Me.ComboBox1.AddItem sh.Name
End If
Next


"Greg Snidow" wrote:

Greetings. I am loading a combo box list on the initialize event with code I
found here, and it works perfectly.

For Each sh In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem sh.Name
Next

However, there are two sheets, the last two that I don't want to show up in
the list. I can't find an easy way to keep these two sheets out. Any ideas?
Thank you.

Greg


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Loading combo box list

If it's always the last 2 sheets you don't want then you could use this which
would be a tade shorter. Hope this helps! If so, let me know, click "YES"
below.

For wks = 1 To Sheets.Count - 2
Me.ComboBox1.AddItem Sheets(wks).Name
Next wks
--
Cheers,
Ryan


"Greg Snidow" wrote:

Ok, that was easy.

For Each sh In ActiveWorkbook.Sheets
If sh.Name < "BDMS" And sh.Name < "HELD" Then
Me.ComboBox1.AddItem sh.Name
End If
Next


"Greg Snidow" wrote:

Greetings. I am loading a combo box list on the initialize event with code I
found here, and it works perfectly.

For Each sh In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem sh.Name
Next

However, there are two sheets, the last two that I don't want to show up in
the list. I can't find an easy way to keep these two sheets out. Any ideas?
Thank you.

Greg


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Loading combo box list

Thanks for the tip. That is actually what I was trying to do, but I was
making it much more complicated than you have done.

"Ryan H" wrote:

If it's always the last 2 sheets you don't want then you could use this which
would be a tade shorter. Hope this helps! If so, let me know, click "YES"
below.

For wks = 1 To Sheets.Count - 2
Me.ComboBox1.AddItem Sheets(wks).Name
Next wks
--
Cheers,
Ryan


"Greg Snidow" wrote:

Ok, that was easy.

For Each sh In ActiveWorkbook.Sheets
If sh.Name < "BDMS" And sh.Name < "HELD" Then
Me.ComboBox1.AddItem sh.Name
End If
Next


"Greg Snidow" wrote:

Greetings. I am loading a combo box list on the initialize event with code I
found here, and it works perfectly.

For Each sh In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem sh.Name
Next

However, there are two sheets, the last two that I don't want to show up in
the list. I can't find an easy way to keep these two sheets out. Any ideas?
Thank you.

Greg


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
Loading a Combo Box with the months of the year Eclypse Excel Discussion (Misc queries) 6 April 12th 07 11:18 PM
Combo Box Loading EA Excel Programming 0 October 17th 06 12:37 PM
Loading list and combo boxes from startup kev_06 Excel Programming 1 June 2nd 06 06:28 PM
Loading Number Formats into Combo Box ExcelMonkey[_190_] Excel Programming 1 March 14th 05 12:38 PM
Loading Sheet Names into Combo Box ExcelMonkey[_156_] Excel Programming 6 September 15th 04 01:30 PM


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