Share via

using vlookup function at different sheets

Ce 21 Reputation points
2022-01-06T19:49:11.597+00:00

Hello all,
i want to write a function by using vlookup function. Table which will be used by vlookup located at sheet 1 but input and output is at the sheet 2. When i run the function, function do not use table, instead of this, it try to use releted columns and rows at sheet 2. How can i fix this? My function as follows;

Function NameDiscount(vntName) As Double
Dim vntMy_range As Variant
NameDiscount = Application.WorksheetFunction.VLookup(vntName, Worksheets("Sheet1").Range("A:C"), 2, True)
End Function

Developer technologies | Visual Basic for Applications
0 comments No comments

Your answer

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