mercredi 28 mars 2018

Update textbox through vlookup if value not in range

I'm using this code

Private Sub ComboBox2_Change()
    On Error Resume Next
    Dim myRange As Range
    Set myRange = Worksheets("cash").Range("BF:BH")
    Price.Value = Application.WorksheetFunction.VLookup(ComboBox2.Value, myRange, 2, 0)
End Sub

select value from textbox2 using vlookup to match value selexted from textbox2 in price , if the value not included in textbox2 there is last price shown. I need if i entered value not in range no price shown.

Aucun commentaire:

Enregistrer un commentaire