Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Zero values in a log chart | Charts and Charting in Excel | |||
Input cell reference is not valid (One Variable Data Table) | Excel Worksheet Functions | |||
Match Last Occurrence of two numbers and Count to Previous Occurence | Excel Worksheet Functions | |||
Comparing a value to a list of values does not work in Excel 2003. | Excel Worksheet Functions | |||
Second serie doesn't use X-as values | Charts and Charting in Excel |