![]() |
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 |
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 |
All times are GMT +1. The time now is 12:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com