VBA Requiring one combobox if another is populated

rvinci

Board Regular
Joined
Jan 28, 2013
Messages
52
Good Morning,

Thank you in advance for the help with this issue.

I am trying to write a portion of code that will require one combobox (dedicatedaccounts) to have an account selected from the list when another combobox (dedicated) says Yes. If dedicated is Yes and there is nothing in dedicatedaccounts I am putting in a msgbox telling the user that it must be populated otherwise if dedicated is No then there will be no msgbox if dedicatedaccounts is blank. Here is what I have so far, not sure if I am on the right path or not. The other msgboxes all work fine.

Code:
If Me.dedicated.Value = Blank Then
    MsgBox ("You must select whether it is dedicated or not.")
    
    Else
    
If Me.um.Value = Blank Then
    MsgBox ("You must select a Unit Manager.")
    
    Else
    
'???(here is where I get lost)

If Me.dedicated.Value = "Yes" Then
    Me.dedicatedaccounts.Value =         
    Exit Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,203,486
Messages
6,055,712
Members
444,809
Latest member
mwh85

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