vllokup in VBA

G

G.P.N.L. c.v.a.

I am a beginner in VBA; nevertheless, I have already several working UDF's
in Excel 2003.

Why does TGI(A213) gives me "#VALUE!"
- while A213 contains "30/11/2013",
- the formula - in the right module - is :
Option Explicit

Function TGI(ABC As Date) As Single

TGI = Application.WorksheetFunction.VLookup(ABC, _

Range(Workbooks("INDEX.XLS").Worksheets("INDEX").Range("DBINDEX")),
_

2, _

True)
End Function
- the range DBINDEX in the sheet INDEX in the workbook INDEX.XLS is A2:G470,
and
- in that range cella A373 contains "30/11/2013" ?

Can somebody help me ?
 
A

Anthony

I don't think you need the range part of the lookup. Try

TGI = Application.WorksheetFunction.VLookup(ABC,
Workbooks("INDEX.XLS").Worksheets("INDEX").Range("DBINDEX"), 2, False)

I don't know what your referencing, so cant give you the exact code you
need.
 

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

Similar Threads


Top