jparfitt87
New Member
- Joined
- Jul 13, 2012
- Messages
- 23
Ok so i've been working on this inbetween my day to day job and i still can't work it out!
I'll try and keep it simple:
I am trying to populate 3 different answer sets within a Userform Listbox or ComboBox.
The answer set displayed is dependant on what is selected on the "Answers" Sheet.
For example If i have select "Answer_Set_1" then "Excellent, Good, Neither Good or Bad etc" will be shown within the ComboBox
The Code I have so far which i can't seem to get to work is:
For X = 1 To 10 'This is the Variable to go through the worksheet range "ResponceQ1 - 10"
AStr = "CmbQ" & X & "AV" 'This is the variable to go through the ComboBox's to then pickup the answer set.
For Each ctrl In UserForm1.MultiPage1.Pages(0).Controls 'This runs through the first pages controls.
If TypeName(ctrl) = "Combobox" Then 'This determines the control type
If Left(ctrl.Name, 4) = "CmbQ" Then 'This finds the controls name
'This is the part i'm struggling with........
If Worksheets("Questions").Range("ResponceQ" & X) = "Answer_Set_1" Then
'This part of the code goes through the worksheet Ranges and finds what typ of answer has been selected.
Userform1.Controls.List(AStr) = Worksheets("Answers").Range("Answer_Set_1").Value
'This part of the code is supposed to bring the answers selected into the Conbobox selected but doesn't
Else
I'm really at a loss with this, i know i'm on the right lines but can't seem to get any further.
Please help
Regards
Jamie
I'll try and keep it simple:
I am trying to populate 3 different answer sets within a Userform Listbox or ComboBox.
The answer set displayed is dependant on what is selected on the "Answers" Sheet.
For example If i have select "Answer_Set_1" then "Excellent, Good, Neither Good or Bad etc" will be shown within the ComboBox
The Code I have so far which i can't seem to get to work is:
For X = 1 To 10 'This is the Variable to go through the worksheet range "ResponceQ1 - 10"
AStr = "CmbQ" & X & "AV" 'This is the variable to go through the ComboBox's to then pickup the answer set.
For Each ctrl In UserForm1.MultiPage1.Pages(0).Controls 'This runs through the first pages controls.
If TypeName(ctrl) = "Combobox" Then 'This determines the control type
If Left(ctrl.Name, 4) = "CmbQ" Then 'This finds the controls name
'This is the part i'm struggling with........
If Worksheets("Questions").Range("ResponceQ" & X) = "Answer_Set_1" Then
'This part of the code goes through the worksheet Ranges and finds what typ of answer has been selected.
Userform1.Controls.List(AStr) = Worksheets("Answers").Range("Answer_Set_1").Value
'This part of the code is supposed to bring the answers selected into the Conbobox selected but doesn't
Else
I'm really at a loss with this, i know i'm on the right lines but can't seem to get any further.
Please help
Regards
Jamie