Evaluate multiple combobox values

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
Can someone help me with this please, it's one area of VBA which I have never been able to truly understand no matter how hard I try;

I have 3 Comboboxes on a Userform, named ComboES1, 2 and 3.

I want a routine to run when the Comboboxes are changed to do other bits in the following circumstances;

1) If ANY of the 3 Comboboxes are blank do nothing

2) If any have a value of "YES" (subject to the other 2 not being blank as above)

3) If any have a value of "NO" (subject to the other 2 not being blank)

I can sort out the bits that need to run if the condition is met, it's creating the conditions that confuses me.

Thanks guys.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Re: Evalute multiple combobox values

Hi
I'm not sure I understand what you're asking. Just the logic when a combo box changes, or how to tell when a combo box changes?

If it's the logic then is this what you mean?
Code:
If ComboES1.Value = "" Or ComboES2.Value = "" Or ComboES3.Value = "" Then
    'Do nothing
Else
    If ComboES1.Value = "Yes" Or ComboES2.Value = "Yes" Or ComboES3.Value = "Yes" Then
        'Do something else
    Else
        If ComboES1.Value = "No" Or ComboES2.Value = "No" Or ComboES3.Value = "No" Then
            'Do something else
        End If
    End If
End If

Do you know what you want to do if 1 has already changed to "Yes" and you've run the code, then the user selects "No" in another. Or vice versa.
 
Last edited:
Upvote 0
Re: Evalute multiple combobox values

Hi Johnny,

Thanks - I'll give your suggestion a try. In essence I want the evaluation to run every time each combobox changes, if that makes sense. I'll try your suggestion and report back.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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