Case statement

  • Thread starter Thread starter smi
  • Start date Start date
S

smi

I am using Excel 97 with Win 95. I have a project with a lot of If and
ElseIf statement. It work but not very clean programming.
I am looking for Case statement example on the net.
Thank you for your time.

Long
 
A Select Case statement if quite simple, and fairly well documented in the
VBA help files. A simple example of Select Case is

Dim X As Integer
X = 3
Select Case X
Case 1
MsgBox "X=1"
Case 2
MsgBox "X=2"
Case 3
MsgBox "X=3"
Case Else
MsgBox "X = something else"
End Select



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
Back
Top