R
Rachel
I have a combo box (cboitem1) and a text box (txtprice1). I am using the code
below to have txtprice1 fill with the corresponding price the worksheet:
Private Sub Cboitem1_Change()
If cboItem1 <> "" Then
txtprice1.Value = Excel.WorksheetFunction.VLookup(cboItem1.Value,
Sheets("Pizzas").Range("A1:B65536"), 2, False)
End If
End Sub
It works perfectly when you enter an existing value in cboitem1. However if
'the user' accidently types a letter that is not the first letter of one of
the existing items VB debugging pops up with error "Unable to get the Vlookup
property..."
I am assuming this is because the Vlookup function is giving afalse value.
How can I get it to not revert to the debugging and just give an error
message?
Thanks in advance!
R
below to have txtprice1 fill with the corresponding price the worksheet:
Private Sub Cboitem1_Change()
If cboItem1 <> "" Then
txtprice1.Value = Excel.WorksheetFunction.VLookup(cboItem1.Value,
Sheets("Pizzas").Range("A1:B65536"), 2, False)
End If
End Sub
It works perfectly when you enter an existing value in cboitem1. However if
'the user' accidently types a letter that is not the first letter of one of
the existing items VB debugging pops up with error "Unable to get the Vlookup
property..."
I am assuming this is because the Vlookup function is giving afalse value.
How can I get it to not revert to the debugging and just give an error
message?
Thanks in advance!
R