![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com