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: 1
Default Function runs more than once


Dear all,

The following function is a sample in Excel's help. When I use it in a
worksheet giving a cell reference as the argument (the cell contains a
formula which refers to other cells), the function runs twice. I mean
when the line End Function was executed, it just went back to the first
line (_If_NumberArg_<_0_Then_) and run all lines
through again. I also have a few DIY functions that run even four times
when used in worksheet.



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


Can anyone tell me why is this phenomenon and how to stop this
happening?

Many thanks,

Huyeote


--
Huyeote
------------------------------------------------------------------------
Huyeote's Profile: http://www.excelforum.com/member.php...o&userid=13894
View this thread: http://www.excelforum.com/showthread...hreadid=549330

 
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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
OLE text runs together T-Rex[_3_] Excel Programming 0 May 20th 05 10:02 PM
macro runs except from function Brenda[_6_] Excel Programming 1 January 22nd 04 04:20 AM


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

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

About Us

"It's about Microsoft Excel"