Home » excel » excel – Unable to get the Vlookup property of the WorksheetFunction class

excel – Unable to get the Vlookup property of the WorksheetFunction class

Posted by: admin April 23, 2020 Leave a comment

Questions:

I am trying to find an Employee name and their Import date from a spreadsheet called CashReward.

The coding below is appearing with an error message ‘Unable to get the Vlookup property of the WorksheetFunction class’. I have tried changing the data type to CDate and CStr but no use.

concat = EmpName & GetDate

BasicSal = WorksheetFunction.VLookup(CVar(concat), Sheets("CashReward").Range("G3:K" & Cashlastrow), 2, False)

Thanks in advance

How to&Answers:

This happens if your search string is not found in the given range.

Note that the data in the range needs to be sorted in ascending order, see http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx

The values in the first column of table_array must be placed in
ascending sort order; otherwise, VLOOKUP may not give the correct
value. You can put the values in ascending order by choosing the Sort
command from the Data menu and selecting Ascending. For more
information, see Default sort orders.

Answer:

Amy one can solve this erroe run time error ‘424’ object require

Private Sub VLOOKUP()
Dim I As Integer
Dim J As Integer
Dim K As Integer

For I = 2 To 14

For J = 1 To 1
For K = 2 To 2


Sheet2.Cells(I, K) = Appliaction.WorksheetFunction.VLOOKUP(Sheet2.Cells(I, J), Sheet1.Range("$A$1:$C$307"), 2, False)
Next K
Next J
Next I

End Sub