ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run once function (https://www.excelbanter.com/excel-programming/410124-run-once-function.html)

Przemek Wrzesiński

run once function
 
Hi,

I have following custom function:

Public Function InterestCapitalisation(freq As String) As Double
Dim source As Range
Set source = Application.Caller()
Dim qperiod As Integer
Dim qwynik As Double
qperiod = source.Offset(0, -4).Value
qwynik = qperiod / 3
Select Case freq
Case "monthly"
InterestCapitalisation = source.Offset(0, -1).Value
Case "quarterly"
If Not (Int(qwynik) * 3 = qperiod) Then
source.Value = 0
Else
InterestCapitalisation = source.Offset(0, -1).Value + _
source.Offset(-1, -1).Value + source.Offset(-2, -1).Value

End If
End Select

Unfortunately when function is evaluating once it's firing again causing
cyclic reference.

How can I remove this cyclic reference?

Przemek

End Function


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

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