Select Case

Select Case statement is an alternative to the ElseIf statement.  This method is more efficient and readable in coding the the If ... Then ... ElseIf statment. 

Example:

    Select Case Grade
        Case Is >= 90
            LetterGrade = "A"
        Case Is >= 80
            LetterGrade = "B"
        Case Is >= 70
            LetterGrade = "C"
        Case Is >= 60
            LetterGrade = "D"
        Case Else
            LetterGrade = "Sorry"
    End Select

Comments

Popular posts from this blog

50 Excel VBA Oral Interview Questions