ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using functions (https://www.excelbanter.com/excel-programming/443568-using-functions.html)

PCOR

Using functions
 
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

Don Guillett Excel MVP

Using functions
 
On Aug 30, 2:08*pm, pcor wrote:
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....

Gord Dibben[_2_]

Using functions
 
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

On Mon, 30 Aug 2010 12:08:39 -0700 (PDT), pcor wrote:

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



All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com