Home > database >  Compare part of Combobox1.value with combobox2
Compare part of Combobox1.value with combobox2

Time:11-17

I have created a userform with comboboxes, I would like to compare the a part of combobox 2 with the value of combobox 1. if they do not match there should be an error given (as in my code, see below), the code that I made is not working, but I do not know what is wrong.

the error that is showing is:

Compile error: Sub or Function not defined @Find

If Left(Me.ComboBox2.Value(Find(" -", Me.ComboBox2.Value, 1) - 1)) <> Me.ComboBox1 Then
  MsgBox "The tag of " & m2.ComboBox2.Tag & "does not match with selected BIN"
  Exit Sub
End If

CodePudding user response:

It is working already with the following code, thanks anyway for the help.

If Left(Me.ComboBox2.Value, InStr(Me.ComboBox2.Value, " -") - 1) <> Me.ComboBox1 Then

MsgBox "The tag of " & me.ComboBox2.Tag & "does not match with selected BIN"

Exit Sub

End If

CodePudding user response:

Did you already attempt qualifying the find function with something like "worksheetfunction.find"?

  • Related