Suppose I have a function attached to one of my Excel sheets:
Public Function foo(bar As Integer) as integer foo = 42 End Function
How can I get the results of foo returned to a cell on my sheet? I’ve tried '=foo(10)', but all it gives me is '#NAME?'
I’ve also tried =[filename]!foo(10) and [sheetname]!foo(10) with no change.
Try following the directions here to make sure you’re doing everything correctly, specifically about where to put it. (
Insert->Module)I can confirm that opening up the VBA editor, using
Insert->Module, and the following code:and on a sheet putting
'=TimesTwo(100)'into a cell gives me200.