I am attempting to recreate the following Excel function which returns the expected result
The code I am using to recreate this is
but I get a 'Unable to get the Vlookup property of the WorksheetFunctionclass'
In the Excel formula B8 = 10 Jun 19 in a date format
In the VBA code dtStart + lngCount returns the same in a date format (dtStart is declared as a date variable)
In the Excel formula 'Rates_Lookup' is the correct range
In the VBA code rngRatesLookup is based on the same range
I have used this VBA function before but I just can't see what is wrong with the VBA version.
TIA
Code:
=VLOOKUP(B8,Rates_Lookup,3,FALSE)
The code I am using to recreate this is
Code:
.Offset(lngCount, intLoans * 2) = Application.WorksheetFunction.VLookup(dtStart + lngCount, rngRatesLookup, 3, False)
In the Excel formula B8 = 10 Jun 19 in a date format
In the VBA code dtStart + lngCount returns the same in a date format (dtStart is declared as a date variable)
In the Excel formula 'Rates_Lookup' is the correct range
In the VBA code rngRatesLookup is based on the same range
I have used this VBA function before but I just can't see what is wrong with the VBA version.
TIA