Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default List sheet names in "pop-up" box for users to select

Ok, So I figured out how to add and populate a combobox...but the code fires as soon as the selection is made. How do I suspend the code until the OK button is clicked? I thought I was being smart by choosing ComboBox1_DropButtonClick, but that gave me an error!

Here's what I have:

Private Sub ComboBox1_Click()

gsWksTargetName = ComboBox1.List(ComboBox1.ListIndex)
Unload Me

End Sub

Private Sub UserForm_Initialize()

Dim wks As Worksheet
For Each wks In ThisWorkbook.Sheets
If wks.Visible Then ComboBox1.AddItem wks.Name
Next 'wks
Me.Caption = "Select Target"

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default List sheet names in "pop-up" box for users to select

Steve submitted this idea :
Ok, So I figured out how to add and populate a combobox...but the code fires
as soon as the selection is made. How do I suspend the code until the OK
button is clicked? I thought I was being smart by choosing
ComboBox1_DropButtonClick, but that gave me an error!

Here's what I have:

Private Sub ComboBox1_Click()

gsWksTargetName = ComboBox1.List(ComboBox1.ListIndex)
Unload Me

End Sub

Private Sub UserForm_Initialize()

Dim wks As Worksheet
For Each wks In ThisWorkbook.Sheets
If wks.Visible Then ComboBox1.AddItem wks.Name
Next 'wks
Me.Caption = "Select Target"

End Sub


Nothing wrong with using the combobox. In fact, given many sheets it's
a better choice since you can cycle through its list by repeated typing
the first letter of the sheetname.

Anyway, I deliberately wrote the code so the form closes immediately
after selection is made, to save user the extra step. Since you've
switched to using a combobox then MOVE the line...

Unload Me

...into the OK button Click event.

====
OT:
Is there a reason why you made new posts to respond to the original
topic, rather than 'replying' to that original post?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default List sheet names in "pop-up" box for users to select

Actually, put all the code in ComboBox1_Click into the OK button's
click event. Then delete ComboBox1_Click.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


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
List sheet names in "pop-up" box for users to select Steve[_4_] Excel Programming 1 May 3rd 11 11:26 PM
List sheet names in "pop-up" box for users to select Steve[_4_] Excel Programming 1 May 3rd 11 07:43 PM
Adding to a "list sheet names" macro ... [email protected] Excel Programming 2 June 4th 09 06:23 PM
Questionnaire sheet: Select "yes" or "no," and only one can be selected bpatterson Excel Worksheet Functions 2 April 13th 06 11:04 PM
Protect shouldn't default to "allow users to select locked cells" JudiMicro Setting up and Configuration of Excel 0 November 18th 05 05:00 PM


All times are GMT +1. The time now is 10:37 PM.

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"