LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Calling of simple function in Excel 97

Hello:

I am interested in doing some simple programming in Excel 97. The
Help facility in Excel has plenty of examples of writing functions,
but does little to describe how to call a user-written function from a
spreadsheet.

For example:
I have defined a function such as:

Function CSR(NumberArg As Double) As Double
If NumberArg < 0 Then ' Evaluate argument.
Exit Function ' Exit to calling procedure.
Else
CSR = Sqr(NumberArg) ' Return square root.
End If
End Function

How do I call this from the worksheet? How do I refer to the Active
Cell?
(I've tried to call it by entering =CSRR() in a worksheet, but get a
#NAME error. I am not certain how to use the ActiveCell property to
refer to the passed value properly. I've tried it a number of ways
here to no avail.)

Where do I define this function in the the Visual Basic Editor?
(I've entered it in the General Declarations part of the workbook, and
it seems to 'compile' fine, but does not work!)

Thanks for your help,
Tom
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a new function Excel gives me #NAME? Mark Dvorkin Excel Worksheet Functions 4 July 10th 05 01:29 AM
Calling functions from Excel worksheets and the Find function in XL '97 Mike-hime Excel Programming 1 January 8th 04 03:17 AM
Calling Word function from within Excel Ed[_9_] Excel Programming 1 September 17th 03 11:47 PM
Calling Excel FUNCTION MACROS Programmatically from VB Rob Bovey Excel Programming 0 July 23rd 03 09:35 PM
Calling a function from within EXCEL pcor[_2_] Excel Programming 3 July 18th 03 05:10 PM


All times are GMT +1. The time now is 11:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"