Vba vlookp error

ali zaib

Active Member
Joined
Nov 21, 2010
Messages
412
Dear all,
i have facing problem in below mention codes these code are working properly if value has match but when value not match its show run time error please suggest .

TextBox5.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 5, 0)</SPAN>
TextBox13.Text = WorksheetFunction.VLookup(TextBox5.Value, Sheets("Basis").Range("I1:J100"), 2, 0)</SPAN>
TextBox15.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 2, 0)</SPAN>
TextBox11.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 3, 0)</SPAN>
TextBox12.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 4, 0)</SPAN>
TextBox16.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:H60000"), 8, 0)</SPAN>
TextBox17.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:H60000"), 6, 0)</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
</SPAN>
</SPAN>
</SPAN>

<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Also, if the textbox contains a number

Code:
Dim x As Variant
x = Application.VLookup(Val(TextBox3.Value), Sheets("Basis").Range("A1:F60000"), 5, 0)
If Not IsError(x) Then
    TextBox5.Text = x
Else
    TextBox5.Text = "Not found"
End If
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top