View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike DFR Mike DFR is offline
external usenet poster
 
Posts: 5
Default Excel macro crashes if an entry in a combo box is not in the list

I am using a combo box on a form to find a part in a list, if the combo is
left empty a message is displayed. the code is as follows
If Trim(Me.cboPart.Value) = "" Then
Me.cboPart.SetFocus
MsgBox "Please enter a part number"
Exit Sub
End If
But if I enter a number not on the list, the debug window pops up.
I can not seem to find the syntax to say 'If the combo value finds no match
then show error message'.
I would think it is just a case of putting the 'no match' in place of the ""
I am greatful for any pointers.