Thursday, February 23, 2012


Function MyAdding(X As Integer) As Integer
    MyAdding = X + 15
End Function

Sub foo()
    For i = 4 To 1 Step -1
        Debug.Print "i is now " & i
    Next
End Sub

i = i - 1
i = i + 1

Function Ordinal(X As Integer) As String
    Last2Digits = Val(Right(X, 2))
    If Last2Digits = 11 Or Last2Digits = 12 Or Last2Digits = 13 Then
        Ordinal = X & "th"
        Exit Function
    End If

    lastdigit = Val(Right(X, 1))
    If lastdigit = 1 Then
        Ordinal = X & "st"
    ElseIf lastdigit = 2 Then
        Ordinal = X & "nd"
    ElseIf lastdigit = 3 Then
        Ordinal = X & "rd"
    Else
        Ordinal = X & "th"
    End If
End Function

No comments:

Post a Comment