Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Case Instructions

Posted on 2000-04-21
2
138 Views
Last Modified: 2010-05-02
Dear friend i wrote a code to make the following:

code to do one of the following actions, depending on the value of Choice:

i.When Choice is 3, 5, or 7, add 1 to a variable called Counter.

ii.When Choice is between 8 and 15 inclusive, set Counter to 0.

iii.When Choice is has any other value,display "invalid code" in a message box,

*****Code begin**********

Dim inChoice As Integer
Dim inCounter As Integer
inCounter = 0
inChoice = Val(Text1)
Select Case inChoice
    Case 3, 5, 7
        inCounter = inCounter + 1
    Case 8 To 15
        inCounter = 0
    Case 1, 2, 4, 6
        MsgBox "Invalid Code!", vbExclamation
        Exit Sub
    Case Is > 15
        MsgBox "Invalid Code!", vbExclamation
        Exit Sub
End Select

*********Code end*****
This code is right?? How can test this code???

Thanks,

Jairo Cardenas
Colombia
0
Comment
Question by:jcardenas
2 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 15 total points
ID: 2738839
to test it put a textbox and a command button on your form

paste the above code into the command button's click event

type a number into the textbox and click the button
0
 

Author Comment

by:jcardenas
ID: 2738855
My Friend, i have tested it according your instruction and it work fine.

Thanks and happy easter,

Jairo Cardenas
Colombia
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question