<-- Previous || Up || Next -->

Days 360 Excel Test Sub
Math Financial Class

Public Sub Days360ExcelTest()
    'Compare the Excel and non-Excel versions of the Days360 function.

    Const datBeg = #1/1/1991#
    Const datEnd = #1/1/1998#

    Dim datFm As Date, datTo As Date, vMethod%, lngXL&, lngES&

    For datFm = datBeg To datEnd
        DoEvents
        If Day(datFm) = 1 Then Debug.Print Now, datFm

        For datTo = datBeg To datEnd
            For vMethod = -1 To 0
                lngES = Days360(datFm, datTo, vMethod, False)
                lngXL = Days360(datFm, datTo, vMethod, True)

                If lngXL <> lngES Then
                    Debug.Print _
                          "    '  " _
                        & "#" & Format$(datFm, "mm/dd/yyyy") & "#" _
                        & " #" & Format$(datTo, "mm/dd/yyyy") & "#" _
                        & " " & Left$(IIf(vMethod = -1, "True", "False") & Space$(5), 5) _
                        & " " & Right$(Space$(6) & Format$(lngES, "#,##0;-#,##0"), 6) _
                        & " " & Right$(Space$(6) & Format$(lngXL, "#,##0;-#,##0"), 6)
                End If
            Next vMethod
        Next datTo
    Next datFm
End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.