I am using the following statement
if worksheetfunction.iserror(worksheetfunction.vlookup(sheet1.cells(i,j).value,sheet2.range("range1"),2,0)) = true then
can you please whether this is legal... my vba compiler is crashing when i am trying this
Assuming i,j & range1 are all valid then perhaps:
If IsError(Application.Vlookup(sheet1.Cells(i,j).value,sheet2.range("range1"),2,0)) Then
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There's nothing wrong with the syntax itself, assuming the sheets exist and the variables are correct.
How come then i am getting the following error
unable to get vlookup property of worksheetfunction class
@DonkeyoTe..
Thanks for the tip..
works like a charm
I thought you were getting a compile error, not a runtime one. The issue, as solved by DO, is that the WorksheetFunction.VLookup returns a runtime error, not an error value, if the value is not found in the table. Using Application.Vlookup returns an error value instead.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks