check and compare value entered in combobox

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
626
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I am using VBA in Excel 2010. I was wondering if there is a simple way to check to see if the value entered in the combobox matches the already populated value within the combobox.
Code:
Private Sub cmbMonth_Enter()     
With Me.cmbMonth
        .AddItem "January"
        .AddItem "February"
        .AddItem "March"
        .AddItem "April"
        .AddItem "May"
        .AddItem "June"
        .AddItem "July"
        .AddItem "August"
        .AddItem "September"
        .AddItem "October"
        .AddItem "November"
        .AddItem "December"
    End With
End Sub
As you can see, this combobox is populated with the values of the names of the months. What I would like to do is, if the user manually types in a month and misspells it, on exit, check and see if what they entered matches with what is in the combobox, if not display a message box.

Thank you.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Why not do it this way
Put this script in a Command Button:
Modify Combobox name
Code:
Private Sub CommandButton2_Click()
'Modified 5/31/18 4:02 AM EDT
Dim i As Long
For i = 1 To 12
    ComboBox4.AddItem Format(MonthName(i), "MMMM")
Next
End Sub
 
Upvote 0
If it's an activex control set the MatchEntry property to 1 - frmMatchEntryComplete
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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