Limit users to combobox list

MFish

Board Regular
Joined
May 9, 2019
Messages
76
I have the property set to, "Match Required" for my comboboxes. I have a clear button that resets all of the values of my comboboxes to nothing, "". It keeps saying the selection is invalid after the clear button is pressed. I'll then fill out the form with the correct information and I'll hit submit, or just exit the userform, and the same message prompts me. How do I get this to stop popping up after the clear button is used or moving forward?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Maybe
Code:
[LEFT][COLOR=#000000][FONT=monospace]Application.DisplayAlerts = [/FONT][/COLOR][COLOR=#07704A][FONT=monospace]False[/FONT][/COLOR][COLOR=#000000][FONT=monospace] [/FONT][/COLOR][/LEFT]
 
Upvote 0
Well, I still need the alerts to display if something is accidentally left blank. Any other way?
 
Upvote 0
You can do something like
Code:
[COLOR=#ff0000]Dim DisableEvents As Boolean[/COLOR]

Private Sub ComboBox2_Change()
   If DisableEvents Then Exit Sub
   'your code here
End Sub

Private Sub CommandButton1_Click()
   DisableEvents = True
   'your code here
   DisableEvents = False
End Sub
The line in red needs to go at the very top of the module, before any code.
 
Upvote 0
Create your MsgBox if something is left blank with focus to that place, so as a user you do not even need to look what is wrong...or simply use
Code:
[FONT=monospace]Application.DisplayAlerts = [/FONT][COLOR=#07704a][COLOR=#07704a][FONT=monospace][FONT=monospace]True[/FONT][/FONT][/COLOR][/COLOR]
after your line
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,938
Latest member
Aaliya13

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