VBA User form

N

Neil Bhandar

Hello,

I have a Combo Box in a form. Based on user input I wish
to perform different actions, unfortunately it is not
going so well.

on the click of a button I have:
UserForm2.Show

then I initiatlize the Combo Box pul down entires:
Private Sub UserForm_Initialize()

ComboBox1.AddItem ""
ComboBox1.AddItem "Y1-Qrtr1"
ComboBox1.AddItem "Y1-Qrtr2"
ComboBox1.Style = fmStyleDropDownList
ComboBox1.BoundColumn = 0
ComboBox1.ListIndex = 0

End Sub

then I have a piece of code that performs a select case
based on the selection in the Combo Box:
Private Sub ComboBox1_Click()
Select Case ComboBox1.Value
Case 1 '"Y1-Qrtr1"
'DO ONE THING
Me.Hide
Case 2 '"Y1-Qrtr2"
'SO ANOTHER THING
Me.Hide
End Select
End Sub

For some reason the Combo Box runs thru with out showing
on the screen... since some of my activies need input I
get an error down stream

Please response.

Thanks in anticipation,
-Neil
 
G

Greg Koppel

Neil,

You need to initialize the userform before showing it, or repaint it after
showing and initializing the combo box.

HTH, Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top