Using Select Case Statement in VBA

If you have large number of conditions to verify, Select Case statement provides a way to check these conditions easily and in readable manner.

Select Case EmployeeName

Case “Michael Douglas”

EmployeeDesig = “CEO”

Case “Tina Wales”

EmployeeDesig = “CFO”

Case “Gina White”

EmployeeDesig = “CIO”

Case “Tim White”

EmployeeDesig = “COO”

Case Else

EmployeeDesig = “Associate”

End Select

Related Posts

Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email will not be published. Required fields are marked *

*
*