Select Case
Routes execution through one of several cases based on a single expression.
Select Case expression
Case "A"
Case Else
End SelectThis static page keeps the syntax and examples indexed for search, while the coding app handles interactive exploration and saved references.
What it does
Overview
Routes execution through one of several cases based on a single expression.
Select Case is cleaner than long ElseIf chains when you are classifying statuses, sheet names, import types, or user choices. It makes multi-branch workbook logic easier to read and maintain, especially in reporting macros where one field drives several different actions.
Quick reference
Syntax
Select Case expression
Case "A"
Case Else
End Select
See it in practice
Examples
Route status codes
Select Case UCase$(Cells(2, 4).Value)
Case "PAID"
Cells(2, 5).Value = "Archive"
Case "OVERDUE"
Cells(2, 5).Value = "Chase"
Case Else
Cells(2, 5).Value = "Review"
End SelectSelect Case keeps status-routing logic easier to scan than many ElseIf branches.
Debug faster
Common Errors
LogicError
Cause: Comparing raw input values that vary by case, spacing, or hidden characters.
Fix: Normalize the driving expression before Select Case when imported data is inconsistent.
Runtime support
Compatibility
Common questions
Frequently Asked Questions
Routes execution through one of several cases based on a single expression.
LogicError: Normalize the driving expression before Select Case when imported data is inconsistent.