Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
below is a piece of code of a custom function I worked on: Function Futures_unr(maturity As Date) As Double Dim lookuprng As Range, adj_maturity As Variant, a As Variant If Weekday(maturity, vbMonday) = 5 Then adj_maturity = (Day(maturity) + 3) & "/" & Month(maturity) & "/" & Year(maturity) Else adj_maturity = (Day(maturity) + 1) & "/" & Month(maturity) & "/" & Year(maturity) End If Set lookuprng = ThisWorkbook.Worksheets("Sheet1").Range("E6:J83") a = Application.WorksheetFunction.VLookup(adj_maturity , lookuprng, 2, False) Futures_unr = a End Function so the input is a date and output should be a numerical value. I get an error while, I think, trying to set up a range for vlookup. Does any have any idea what is causing an error? (vlookup in excel function works fine) Thank you in advance. regards, S |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
help with setting up dynamic name ranges | Excel Worksheet Functions | |||
Using custom functions within custom validation | Excel Discussion (Misc queries) | |||
Ranges in Custom Functions | Excel Programming | |||
How to access ranges in closed workbooks in custom functions | Excel Programming | |||
Setting ranges | Excel Programming |