Show Msgbox / stop code running if Combobox is empty

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am currently using the code below & also supplied a screenshot of the form.

The issue i have is that when i press CHECK MY PART NUMBER it should not continue to run the codeif ComboBox2 is empty.
Basically ComboBox2 should show a value for it to continue,if empty then i will add a Msgbox but not sure where ive gone wrong.

Please advise thanks



Rich (BB code):
Private Sub CheckMyPartNumber_Click()
    If ComboBox2.Value > 1 Then
        HondaParts.MyPartNumber.Value = ComboBox2.Value
        HondaParts.Show
    Else
        MsgBox "NO HONDA PART NUMBER WAS SELECTED", vbCritical, "HONDA PART NUMBER LOOK UP MESSAGE"
    End If

End Sub
 

Attachments

  • 1582.jpg
    1582.jpg
    82.3 KB · Views: 6

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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