Using functions

P

pcor

I would like to use a home made FUNCTION to divide two numbers
So far In a module I have placed the following code:
Function cutit(a%,b%)
cutit=a%/b%
end function
In the spread sheet I call the function:
=cutit(12,6)

I them get the error message NAMe$
what am I doing wrong
 
D

Don Guillett Excel MVP

I would like to use a home made FUNCTION to divide two numbers
So far In a module I have placed the following code:
Function cutit(a%,b%)
cutit=a%/b%
end function
In the spread sheet I call the function:
=cutit(12,6)

I them get the error message NAMe$
what am I doing wrong

Although you could just use =12/6 I suspect that if you take your
function out of the SHEET module and place in a REGULAR module, it
will work....
 
G

Gord Dibben

Your UDF works for me as is when function is in same workbook.

=cutit(12,6) returns 2

Where do you have it stored?

A module in the workbook or a module in an external workbook like Personal.xls?

=Personal.xls!cutit(12,6) would be OK


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top