Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I've got a function called add(a as int, b as int) that returns a +
b, defined in the correct sheet and workbook I'm currently using. I'd like to be able to call this function from a cell, ie enter in cell A1 the text "=add(4,5)" (without the quote marks) and have it return the answer. I get a NAME? error when I do this. What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Place this code on a normal module sheet.
It can then by used as a normal maths formula Code will need to be modified if a or b is a multiple ranges Function MyFunction(a As Range, b As Range) As Integer MyFunction = a.Value + b.Value End Function --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put the code in a normal code module, not the ThisWorkbook module
or one of the Sheet modules. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "rturner138 " wrote in message ... Hi, I've got a function called add(a as int, b as int) that returns a + b, defined in the correct sheet and workbook I'm currently using. I'd like to be able to call this function from a cell, ie enter in cell A1 the text "=add(4,5)" (without the quote marks) and have it return the answer. I get a NAME? error when I do this. What am I doing wrong? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calling functions from dll | Excel Programming | |||
Calling certain functions within VBA | Excel Programming | |||
Calling certain functions within VBA | Excel Programming | |||
Calling certain functions within VBA | Excel Programming | |||
Calling VBA functions from a xll | Excel Programming |