ComboBoxes - check if a value is selected.

Pacman52

Active Member
Joined
Jan 29, 2009
Messages
319
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Using 1 combobox as an example (there are multiple copies of it).

So I have cmbProd1 and txtQty1.

Once a user selects an item in the combobox list the focus moves to the quantity textbox and the quantity textbox checks for any value that is NOT numeric in the BeforeUpdate sub - this works fine.

What I'm trying to sort now is the Exit sub to check if the combobox has an item from the list selected then the quantity box can not have a number lower than 1.

I'm ok on sorting the number check but what I can't workout is how do I check the combobox has a value to be able to check if a number in the quantity box is required?

I've tried various methods to check the combobox ...listcount, value, >"", ect ect bout nothing seems to work - the code below is a rough test

Thanks for any help offered. Paul

VBA Code:
Private Sub txtQty1_Exit(ByVal Cancel As MSForms.ReturnBoolean)


If Not IsNull(ComboProd1) And Not IsNumeric(txtQty1.Value) Or txtQty1.Value = "" Then
MsgBox "nothing"

Else

MsgBox "something"
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi thanks so much for the reply. The second link you sent over did the trick thankfully.

I had already tried the listindex option but did realise it needed to be '-1' and if I'm honest I still don't understand why but its working now so I can move forward with the workbook.

Thanks again Paul
 
Upvote 0
Hi thanks so much for the reply. The second link you sent over did the trick thankfully.

I had already tried the listindex option but did realise it needed to be '-1' and if I'm honest I still don't understand why but its working now so I can move forward with the workbook.

Thanks again Paul
You're welcome, and happy to help.
 
Upvote 0

Forum statistics

Threads
1,215,072
Messages
6,122,966
Members
449,094
Latest member
Anshu121

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