View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
JRXPL JRXPL is offline
external usenet poster
 
Posts: 8
Default Functions in VBA used in spreadsheet cell

Thanks for checking it. It is in the general module for the sheet the cell
is in. I even tried typing it in a cell in all sheets. Still not working???
--
Thank you,
JRXPL


"Dave Peterson" wrote:

It worked fine for me.

And you did put it in a General module in the workbook's project that held the
worksheet with the cell with the formula?

JRXPL wrote:

Thank you very much-

I checked the Macro Security and set it to low. I typed the following into
the General module, no ranges, checked spelling. It still doesn't work when
I type the below command into the excel cell.

Function CalculateOne(a, b)
CalculateOne = a + b
End Function

=CalculateOne(2,3)

--
Thank you,
JRXPL

"Dave Peterson" wrote:

Make sure your function is in a General module--not under the ThisWorkbook
module, not behind a worksheet module.

Make sure you allow macros to run when you open your workbook.

And if you use ranges in your formula, make sure you're spelling the addresses
correctly.

If the problem doesn't go away, then make sure you share what you typed into the
cell.

ps. I'm assuming the typos in the function are just in the post. In the
future, it's better to copy directly from your code and paste into the message.

JRXPL wrote:

I have written an extremely simple function in VBA module for sheet 1 and
when I try to use that function in a cell in sheet 1 I get a *Name? error.
Has anyone seen this before? How do I get the function to work?

Function CalculateOne (a,b)
CalculateOne = 2*a + b
EndFunction

--
Thank you,
JRXPL

--

Dave Peterson


--

Dave Peterson