View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme
 
Posts: n/a
Default how to create my own functions??

Would take too long to give a good answer.
You want to make a User Defined Function (aka Custom FUnction)
Use Google to search:Excel + VBA + user defined function (advanved search is
best)
Here are a few hits:
http://www.vertex42.com/ExcelArticle...functions.html
http://www.tushar-mehta.com/excel/vba/

You function will look like this:

Function Distance(x1,y1,x2,y2)
Distance =Sqr( (x1-x2)^2 + (y1-y2)^2)
End Function

It would be called with (for example) =DISTANCE(A1, A2, B1, B2)

You need to know what function Visual Basic has (e.g Sqr for square root)
And how to call Excel functions; example
x=Application.WorksheetFunction.Asin(y)
If VBA has equivalent function (Sqr) you cannot use Excel's (SQRT)

Have fun learning
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"anthropomorfic"
<anthropomorfic.22zdvo_1139520303.5775@excelforu m-nospam.com wrote in
message news:anthropomorfic.22zdvo_1139520303.5775@excelfo rum-nospam.com...

HI

I ever like to know if there is a way to create my own functions, (ex:
the distance between two coordinates of points in space).

if there is a way I'll be happy if someone can tell me how

:)

bye and tvm


--
anthropomorfic
------------------------------------------------------------------------
anthropomorfic's Profile:
http://www.excelforum.com/member.php...o&userid=31382
View this thread: http://www.excelforum.com/showthread...hreadid=510788