-
Solved: Calling a function from a worksheet formula
I am using excel 2007. I am trying to call a function from a worksheet formula. This is an example from a book, but I cannot get it to work. Here is my code
Sub CallerSub()
MsgBox CubeRoot()
End Sub
Function CubeRoot(number)
CubeRoot = number ^ (1 / 3)
End Function
I am trying to call the function by typing in a cell =CubeRoot(1728). The error I get says "Ambiguous Name Detected: Cube Root"
What did I do wrong?
Thanks,
Rodney
-
It sounds like you have two routines named CubeRoot.
Where is the code that you posted, in a normal module or a sheet's code module?
In the VBEditor, use Find to look for CubeRoot and mark the search through entire project box. That should find the duplicate declaration.
-
The code was in a normal module. You were right, I had more than one module with CubeRoot in it. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules