View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_428_] mudraker[_428_] is offline
external usenet poster
 
Posts: 1
Default using variable from input box


When testing a variable cell etc for multiple conditions it is best to
use Select Case statements nstead of If statements

If commands are case sensitve so EPT is not the same as ept or Ept
Use Lcase or Ucase to convert text to all uper or lower case letters

The following code is based on the code in Gary's reply


Sub marine()
Dim s As String
s = Application.InputBox(prompt:="enter LTX or EPT", Type:=2)
Select Case UCase(s)
Case "EPT", "LTX"
MsgBox ("Thanks")
Case Else
MsgBox ("I am leaving")
End Select
End Sub


--
mudraker

If my reply has assisted or failed to assist you I welcome your
Feedback.

www.thecodecage.com
------------------------------------------------------------------------
mudraker's Profile: http://www.thecodecage.com/forumz/member.php?userid=18
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=108422