Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default Comparing input to numerous values

Maybe like this:

Dim ans As String
ans = InputBox("Enter Letter")
Select Case ans
Case "A", "B", "C", "D"
'do whatever
Case Else
MsgBox "Incorrect Input"
End Select

Hope this helps
Rowan

mjack003 wrote:
Howdy,

Is there a simple way in VBA to compare input from the user to a set
amount of constants? Example: Input box asks for a value, then I need
to compare that value to A,B,C,D. If the input does not equal one of
the four then an error msg pops up. Would rather not write four if
then statements.

Thanks in advance,

Mjack


  #2   Report Post  
Posted to microsoft.public.excel.misc
mjack003
 
Posts: n/a
Default Comparing input to numerous values


Howdy,

Is there a simple way in VBA to compare input from the user to a set
amount of constants? Example: Input box asks for a value, then I need
to compare that value to A,B,C,D. If the input does not equal one of
the four then an error msg pops up. Would rather not write four if
then statements.

Thanks in advance,

Mjack


--
mjack003
------------------------------------------------------------------------
mjack003's Profile: http://www.excelforum.com/member.php...fo&userid=5141
View this thread: http://www.excelforum.com/showthread...hreadid=494017

Reply
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
Zero values in a log chart Joelle_Smith Charts and Charting in Excel 2 May 8th 23 03:42 AM
Input cell reference is not valid (One Variable Data Table) Dottore Excel Worksheet Functions 9 September 1st 05 03:05 PM
Match Last Occurrence of two numbers and Count to Previous Occurence Sam via OfficeKB.com Excel Worksheet Functions 33 April 4th 05 02:17 PM
Comparing a value to a list of values does not work in Excel 2003. RagDyer Excel Worksheet Functions 3 March 29th 05 02:12 AM
Second serie doesn't use X-as values JackRnl Charts and Charting in Excel 1 January 20th 05 01:04 AM


All times are GMT +1. The time now is 10:16 AM.

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

About Us

"It's about Microsoft Excel"