Results 1 to 6 of 6

Following UDF is NOT yielding result. Could you please where the problem is?

Threaded View

  1. #1
    Registered User
    Join Date
    10-06-2012
    Location
    Kolkata
    MS-Off Ver
    Excel 2010
    Posts
    2

    Following UDF is NOT yielding result. Could you please where the problem is?

    Would request expertise of all the respected members, in the following post.
    Following UDF is NOT yielding result. Could you please where the problem is?

    Option Explicit
    Private Function BBHTRRr() As Double
    'By Bibek Bhattacharyya
    Application.Volatile True
    Application.Calculation = xlCalculationAutomatic
    
    On Error GoTo ErrorSink
    
    Dim j As Integer
    j = 0
    
    Dim RGuess As Double
    Dim RLow As Double
    Dim RHigh As Double
    Dim LtLow As Double
    Dim LtHigh As Double
    Dim RtLow As Double
    Dim RtHigh As Double
    Dim DiffLow As Double
    Dim DiffHigh As Double
    
    RGuess = 1.25
    
    Do
    
        j = j + 1
    
        RLow = RGuess * 0.99
        RHigh = RGuess * 1.01
    
        LtLow = RLow
        LtHigh = RHigh
    
        RtLow = Application.WorksheetFunction.Exp(0.936 * ((RLow / 97) * ((100 - (3 * RLow)) - 1)))
        RtHigh = Application.WorksheetFunction.Exp(0.936 * ((RHigh / 97) * ((100 - (3 * RHigh)) - 1)))
    
        DiffLow = (RtLow - LtLow)
        DiffHigh = (RtHigh - LtHigh)
    
        If DiffLow < 0 Then
            RLow = RLow - DiffLow
        ElseIf DiffLow > 0 Then
            RLow = RLow + DiffLow
        End If
    
        If DiffHigh < 0 Then
            RHigh = RHigh - DiffHigh
        ElseIf DiffHigh > 0 Then
            RHigh = RHigh + DiffHigh
        End If
    
        RGuess = (RLow + RHigh) / 2
    
    Loop Until DiffLow <> 0 And DiffHigh <> 0 Or j < 1501
    
    BBHTRRr = RGuess
    
    Application.Volatile True
    Application.Calculation = xlCalculationAutomatic
    
    ErrorSink:
    End Function
    Last edited by JBeaucaire; 03-07-2013 at 02:31 AM. Reason: Added code tags, as per forum rules. Don't forget!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1