|
-
Aug 16th, 2005, 12:25 PM
#1
Thread Starter
New Member
[RESOLVED] Multiple ComboBoxes Change Event? And ComboBox(variable)
I am working with 27 ComboBoxes on a UserForm that all work to form a model code. I have two questions...
First Question:
How do I make a private sub that is a change event if ANY of the combo boxes change?
Instead of:
Private Sub ComboBox1_Change()
Private Sub ComboBox2_Change()
Private Sub ComboBox3_Change()
...
...
...
Private Sub ComboBox27_Change()
Use This:
Private Sub Any ComboBox_Change() - how do I do this?
Second question:
How do I refer to a variable combo box?
If n = 5, then refer to ComboBox5
Thanks for any help you can offer...
Rookie
-
Aug 16th, 2005, 12:27 PM
#2
Re: Multiple ComboBoxes Change Event? And ComboBox(variable)
You should create a control array. Then you can access your comboboxes like this :
VB Code:
Private Sub ComboBox_Change(Index As Integer)
ComboBox(2).ListIndex = 7 '<--- number in the parenthesis shows which combobox you are accessing
Has someone helped you? Then you can Rate their helpful post. 
-
Aug 16th, 2005, 01:07 PM
#3
Thread Starter
New Member
Re: Multiple ComboBoxes Change Event? And ComboBox(variable)
Manavo,
Thank you, but I'm still lost. If I'm a first grader trying to understand Calculus, just let me know and I'll drop it, but I don't know how to establish an array. Is that a simple declaration statement? I can't find anything in the archives or in VBA help.
Rookie
-
Aug 16th, 2005, 04:26 PM
#4
-
Aug 17th, 2005, 04:00 AM
#5
Hyperactive Member
-
Aug 17th, 2005, 09:50 AM
#6
Thread Starter
New Member
Re: Multiple ComboBoxes Change Event? And ComboBox(variable)
Anu,
Yes, the below works. Thanks...
Rookie
i = 7
MsgBox Me("ComboBox" & CStr(i)).Value
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|