ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Case statement (https://www.excelbanter.com/excel-programming/279941-case-statement.html)

smi

Case statement
 
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



Chip Pearson

Case statement
 
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


"smi" wrote in message
...
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





Dave Peterson[_3_]

Case statement
 
I searched google for "select case" and found over 7000 posts in the *excel*
newsgroups:

http://groups.google.com/groups?q=%2...+group:*excel*

Here are a couple by Chip Pearson:

http://www.cpearson.com/excel/DateTimeEntry.htm
and
http://www.cpearson.com/excel/DateTimeEntry.htm

smi wrote:

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


--

Dave Peterson



All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com