Application.WorksheetFunction.VLookup error 1004

CrashOD

Board Regular
Joined
Feb 5, 2019
Messages
118
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Dim FinalResult As Variant, Table_Range As Range, LookupValue As Range
Set Table_Range = Sheets("Requestor").Range("A:B")
Set LookupValue = Sheets("Tax Cert Bill").Range("B12")
' original code ' FinalResult = Application.WorksheetFunction.VLookup(LookupValue, Table_Range, 2, False)
' updated code ' FinalResult = Application.WorksheetFunction.VLookup([LookupValue], [Table_Range], 2, False)
On Error Resume Next

i tried both the original worked but when there is no match it give error 1004 i tried the on error resume next but still stops there. I also read
so tried with updated code when the On Error Resume Next did not work.

error
1653661340771.png



code being ran on this sheet
1653661510660.png


Looking name up on requestor page
1653661588492.png



any help would be great. thanks.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you go into the VB Editor, and under the "Tools" menu select "References" an d take a look at the selected references/libraries, do you at least have these four selected?
1653664499463.png

(note they might be a different version number).

If not, select those four and see if that resolved your error.
 
Upvote 0
1653668507545.png



updated profile thing as asked. thanks for letting me know about that.
office 2016 32bit
office 2021 i don't remember if 32bit or 64bit (computer at home i have 64bit os and dont off hand remember what version i installed)

they were already selected.
 
Upvote 0
OK, then it is probably not finding a match.

Note that your:
VBA Code:
On Error Resume Next
line would have to come BEFORE your VLOOKUP calculation lines in order for that to work, as Andrew showed in the link you provided (you have it after - it is too late at that point!).
 
Upvote 0
Solution
OK, then it is probably not finding a match.

Note that your:
VBA Code:
On Error Resume Next
line would have to come BEFORE your VLOOKUP calculation lines in order for that to work, as Andrew showed in the link you provided (you have it after - it is too late at that point!).
thanks i put it before and working great thanks.
 
Upvote 0
You are welcome.

I would recommend that after those VLOOKUP lines of code that you then add the line:
VBA Code:
On Error GoTo 0

Otherwise, any others that your code may incur will be totally ignored. which you probably don't want (you may get a lot of unintended consequences otherwise and/or have lots of issues with code debugging).
 
Upvote 0
On Error Resume Next
FinalResult = Application.WorksheetFunction.VLookup(LookupValue, Table_Range, 2, False)
On Error GoTo 0

thanks i added it. only on in macro on sheets it self i use
=INDEX('[RLE_County Local 2022.xls]Real Estate'!$A:$P,MATCH(C12,'[RLE_County Local 2022.xls]Real Estate'!$P:$P,0),8)

to pull info from 4 different books so different code for were to match to. i am almost dont with what i need for this. im sure someone could probally look at code and clean it up since i take bits and pieces on code to use to make my vba script.

one last issue im waiting on answer for and i think my code maybe done other then getting it to open gmail email to add attachment, excedera is
IE printscreen Call keybd_event(VK_SNAPSHOT, 1, 0, 0) turning NumLock off

thanks so much for your help. !!!!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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