PLwolves87
New Member
- Joined
- Jan 6, 2023
- Messages
- 31
- Office Version
- 365
- Platform
- Windows
Hi, i have a vlookup and would like a msgbox to appear if not found (rather than the textbox being left blank) below is my code if you could please help
Private Sub TextBox27_Change()
'VLookup procedure
Dim costperpallet As String
Dim myrange As Worksheet
costperpallet = Me.TextBox27.Value
Set myrange = ThisWorkbook.Worksheets("JONEN full")
On Error Resume Next
TextBox28.Value = Application.VLookup(TextBox27.Value, Sheets("JONEN full").Range("a:g"), 6, False)
On Error GoTo 0
End Sub
Private Sub TextBox27_Change()
'VLookup procedure
Dim costperpallet As String
Dim myrange As Worksheet
costperpallet = Me.TextBox27.Value
Set myrange = ThisWorkbook.Worksheets("JONEN full")
On Error Resume Next
TextBox28.Value = Application.VLookup(TextBox27.Value, Sheets("JONEN full").Range("a:g"), 6, False)
On Error GoTo 0
End Sub