problem w/ code
Posted by Jim on October 07, 2001 5:37 AM
Hello all,
I need a dialog box that will warn the user if the value
they've entered in the textbox is not a match with the
value in the listbox.
This is what i'm working with:
A userform w/ a listbox, a textbox and a combobox dropdown
the listbox rowsource is sheet1!G66. When you enter a value
in the textbox and click on the combobox dropdown and
select a value 1 thru 10 it then multiplies the listbox value
by the selection. My problem is this works w/ any value
entered in the textbox, and the calculated result will
be the wrong sum if the value entered in the text box
doesn't match the value in the listbox so this is why i
need the dialog box to warn the user.
My code:
Private Sub cbx_1_Click()
If [textbox1].Value = [Sheet1!G66].Value Then
[G66].Value = (textbox1 * cbx_1)
rw = cbx_1.ListIndex
End If
If [textbox1].Value <> [Sheet1!G66].Value Then
MsgBox "the data entered is not a match",vbOKOnly
End If
End Sub
The problem i'm having is the warning box fires off
even if the value entered in the textbox is a match.
Any help would be appreciated
Jim