XLS Padlock Guide
XLS Padlock Guide

select case statements

 

 

VBA Code Protection > Supported VBA syntax by compiler > select case statements

 

Syntax:

 

SELECT CASE selectorExpression
  CASE caseexpr1      statement1
  …
  CASE caseexprn      statementn
CASE ELSE
   elsestatement
END SELECT
 

if selectorExpression matches the result of one of caseexprn expressions, the respective statements will be executed. Otherwise, elsestatement will be executed. Else part of case statement is optional.

Example:

 

SELECT CASE uppercase(Fruit)
CASE "lime"
 ShowMessage("green")
CASE "orange"
 ShowMessage("orange")
CASE "apple"
 ShowMessage("red")
CASE ELSE
 ShowMessage("black")
END SELECT
 

 

function and sub declaration