![]() |
VBA User form
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 |
VBA User form
Neil,
You need to initialize the userform before showing it, or repaint it after showing and initializing the combo box. HTH, Greg "Neil Bhandar" wrote in message ... 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 |
All times are GMT +1. The time now is 05:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com