Excel VBA Xlookup Function - #VALUE! error when using variable

Joe Joel 25 Reputation points
2023-03-07T15:40:56.0566667+00:00

When I specify a cell for the variable, it returns the value I would expect as per below.

User's image

User's image

but when I change arg3 to be defined by a function, it starts to return a #VALUE! error.

User's image

User's image

I don't understand the reason for this. The line of code which the variable is calculated from definited works as shown below.

User's image

User's image

Can somebody please help me find and fix the issue.

Thanks

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Joe Joel 25 Reputation points
    2023-03-08T11:59:46.1766667+00:00

    Issue fixed...

    The variable has been defined as Double and this fixed the error.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.