LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using variable from input box Gary''s Student Excel Programming 0 June 19th 09 07:17 PM
Variable sum from defined input David Excel Worksheet Functions 7 March 10th 09 06:26 AM
Variable Input ryguy7272 Excel Programming 13 May 9th 08 11:44 PM
How Macro Ask for Variable Input? Al Franz Excel Programming 2 July 19th 05 09:37 AM
Input box with variable buggy Excel Programming 2 November 19th 04 03:11 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"