Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't like GoTo's:
Option Explicit Sub testme01() Dim Drk As Long Drk = 0 Do Select Case Range("A1").Value Case Is = "Jim", "Bill" Drk = 1 Case Is = "Jill", "Fred" Drk = 2 Case Else Range("A1") = InputBox("this is not a valid name, " _ & "please enter a valid name and press enter.") End Select If Drk = 0 Then 'keep looking Else Exit Do End If Loop MsgBox Drk End Sub And you don't give the user a way to cancel out of the loop??? And if case doesn't matter: Select Case lcase(Range("A1").Value) Case Is = lcase("Jim"), lcase("Bill") Drk = 1 Case Is = lcase("Jill"), lcase("Fred") jlclyde wrote: Is there anyway to set up this code to use OR for a case statement or a way to check multiple things without putting in another case is =? the code below is a general idea of what I am trying to do. Thanks, Jay E: Select Case Range("A1") .value Case is = "Jim" or "Bill" Drk = 1 Case is = "Jill" or "Fred" Drk = 2 case else range("A`1")=Inputbox("this is not a valid name, please enter a valid name and press enter.") goto E End Select -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select Case Statement | Excel Worksheet Functions | |||
import external data sql case statement | Excel Discussion (Misc queries) | |||
IF STATMENT OR CASE STATEMENT | Excel Discussion (Misc queries) | |||
Anyone actually get Case statement to work ... ? | Excel Worksheet Functions | |||
CASE statement equivalent | Excel Worksheet Functions |