Link to home
Start Free TrialLog in
Avatar of deighton
deightonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

I made this function in Excel 2003 - and all I get is #Value

I've made various functions in a bas module, the simplest of them is

Function z()

    z = "42"
    Return

End Function

When I enter =z() in a cell, i just get #value - the field is formatted as General, but I tried changing it to text with no look, and I tried changing the "42" to 42 with no luck

What I did in Excel was

Tools->Macro->Visual Basic Editor, then I inserted a module and put my function in the module.  

Also when I reloaded the book it told me that macro security was on, so I turned it off (set to low) - still no luck
ASKER CERTIFIED SOLUTION
Avatar of spattewar
spattewar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of spattewar
spattewar

also put the "Public" keyword in front of the function.
Avatar of deighton

ASKER

sorry I tried Public too - it is totally baffling
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great, that is it!

I missed that return had gone in the example,

also it was never in the microsoft example, I put it there