I am using Vlookup to get values from another worksheet.
If there are corresponsding values present, the vba vlookup workks fine.However, I want #N/A to be printed when there is no match but instead of that any random value from the existing values gets printed.
Here is the code I am using:
VlookUp giving random values instead of #N/A.
-
green99 -
November 7, 2017 at 6:56 AM -
Thread is marked as Resolved.
-
-
-
Why use VBA for this? One tip to take note of is not to use On Error whilst testing your code, it will possibly mask useful error warnings.
I would also not use Range and Object as Variable names, they may be reserved words used by Excel and in case will be confusing.
Also, take the time to read the Forum Rules - all code posted on the Forum should be posted using Code Tags
-
Hi Roy
This is not what I was looking for. I am not using the object and Range in my code, this is just to explain the code I wrote here.
Also, I know On Error Resume Next masks all the errors, and I don't use it often.However, in this case error 1004 comes up as vlookup is not able to find the value.
Could you please tell me is there any way to get #N/A in vlookup when values are not present.
If you can suggest anything other than vlookup in vba which does the same functionality is also welcomed -
Use .Find and thanks for understanding about Code Tags!
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!