UDF in XP vs 2003

Pocho

New Member
Joined
Sep 25, 2006
Messages
12
I have the following code... cell G1 of worksheet Fund List contains a counta function for the length of the data


Public Function getname(Ticker As String, Day As Date)

Dim DataFileName As String
Dim rng As Range
Dim Lines As Integer


Lines = Workbooks("MASTER FUND LIST").Worksheets("Fund List").Range("G1").Value + 3
Set rng = Workbooks("MASTER FUND LIST").Worksheets("Fund List").Range(Cells(4, 5), Cells(Lines, 9))
DataFileName = Application.VLookup(Ticker, rng, 5, False)

getname = DataFileName

End Function


It works on my computer at home, but not at my office.
At home I use Office XP while at work it is 2003 - could that be the problem? If so is there something to do to make it work on 2003 and/or on both versions.
If it not a version issue, what else could it be?

Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi Pocho,

I suggest you change

DataFileName = Application.VLookup(Ticker, rng, 5, False)

to

DataFileName = Application.WorksheetFunction.VLookup(Ticker, rng, 5, False)

and see if that helps.

Damon
 
Upvote 0
Thanks for idea, but it does not work on 2003 even with the addition. I have isolated the problem so that even this is not working - not even to mention the vlookup!!

Public Function testings(Ticker As String, Dia As Long)

testings = Workbooks("Book1").Worksheets(Ticker).Range("A1").Value

End Function

from the a worksheet (which has the value 5 in cell A1, Sheet1 in A2 and 345 in A3) I call the UDF with =testings(A2, A3)

result should be 5 - simple as can be. I get #Value

Someone with 2003 please try this and let me know if it works! debugging these UDF's is like the twilight zone!!!

Thanks Bill! :oops: :oops: :oops: :oops:
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top