If ComboBox contains...

Krosis

New Member
Joined
Sep 10, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
So, I have created a userform that has multiple combo boxes with Options 1,2 and 3 across a 7 page multipage. I need help in figuring out how it can check for any instance of say “Option 1” in any of the combo boxes and then pasting that value in a textbox at the beginning of the multipage (overview page).

Hopefully that makes sense!
 
Well again I have a lot of questions.
Like why use a Combobox?
I see only one choice to choose from.
"Standard Not Met"
If any thing else Put "Stand Met"

A Combobox is normally used if there are many choices
Like "One" "Two" "Three" and so on
So if user selects "One" do this.
If user selects "Two" do something else
And so on.
And why would you need 80 comboboxes?

But this questions keeps getting harder to help with. Without knowing your overall goal.
And earlier you mentioned Multipages
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
VBA Code:
Private Sub ComboBox1_Change()

If ComboBox1.value = "Standard Not Met" Then
TextBox10.value = "Standard Not Met"
Else
TextBox10.value = "Standard Met"
End If
End Sub

When working with the code above the aim was.. If combobox1 was "standard not met" then Textbox10 would display "Standard Not Met" and if it didnt it would display "Standard Met" but iv been told I need to input a loop otherwise it just updated as and when a new combo box is updated. In the above code I was only messing with Met and Not Met for now to try and get something working.

The comboboxes are there for the user to select a reply to a question... 80 questions, 80 comboboxes.
and I thought to mention Multipages because I wasnt sure if that made a diff but it turns out it doesnt.

I ended up getting an answer on another forum last night which seems to have worked and as it stands iv not found any issues.
VBA Code:
Private Fail As Boolean

Private Sub UserForm_Initialize()
Dim i As Long
For i = 1 To 3 '! up to 80
    Me.Controls("ComboBox" & i).List = Array("PASS", "FAIL", "N/A")
Next i
End Sub

Private Sub ComboBox1_Change() '! For each of your 80 ComboBoxes
Fail = False: Call CheckMe
End Sub
Private Sub ComboBox2_Change() '! Up to 80
Fail = False: Call CheckMe
End Sub
Private Sub ComboBox3_Change() '! Up to 80
Fail = False: Call CheckMe
End Sub

Private Sub CheckMe()
Dim i As Long
For i = 1 To 3 '! up to 40
    If Me.Controls("ComboBox" & i).Value = "FAIL" Then Fail = True
Next i
TextBox1.Value = IIf(Fail = True, "FAIL", "PASS")
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top