Mega Code Archive

 
Categories / VisualBasic Script / Language Basics
 

A nested Select Case example

Sub CheckCell()       Dim Msg As String       Select Case IsEmpty(ActiveCell)       Case True          Msg = "is blank."       Case Else          Select Case ActiveCell.hasFormula       Case True          Msg = "has a formula"       Case False          Select Case IsNumeric(ActiveCell)          Case True             Msg = "has a number"          Case Else             Msg = "has text"          End Select       End Select       End Select       MsgBox "Cell " & ActiveCell.Address & " " & Msg End Sub