application.vlookup syntax

  • Thread starter Thread starter rwertheimer
  • Start date Start date
R

rwertheimer

Hello,

I'm having trouble with the following piece of code -- it returns "0"
as startprice when it should not. I'm pretty sure the vlookup is not
working properly.

Any help is appreciated.

thanks,
rob

Function returnclose(numdays As Integer) As Long
' calculates return over period indicated by date entered and days in
left hand column
Dim startdate As Date
Dim startprice As Long
Dim enddate As Date
Dim endprice As Long

startdate = Range("startdate").Value
startprice = Application.VLookup(startdate, Range("OPWV_prices"),
2, False)
 
Since it's returning a 0, I think I'd check the data one more time. Maybe that
date appears early in the table, but on a hidden row?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top