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 .

[TABLE="width: 681"]
<TBODY>[TR]
[TD][TABLE="width: 681"]
<TBODY>[TR]
[TD]TextBox5.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 5, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox13.Text = WorksheetFunction.VLookup(TextBox5.Value, Sheets("Basis").Range("I1:J100"), 2, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox15.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 2, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox11.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 3, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox12.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:F60000"), 4, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox16.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:H60000"), 8, 0)</SPAN>[/TD]
[/TR]
[TR]
[TD]TextBox17.Text = WorksheetFunction.VLookup(TextBox3.Value, Sheets("Basis").Range("A1:H60000"), 6, 0)</SPAN>[/TD]
[/TR]
</TBODY><COLGROUP><COL></COLGROUP>[/TABLE]
</SPAN>[/TD]
[/TR]
[TR]
[TD]</SPAN>[/TD]
[/TR]
[TR]
[TD]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
</TBODY><COLGROUP><COL></COLGROUP>[/TABLE]
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,222,229
Messages
6,164,734
Members
451,911
Latest member
HMF009

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