close

Maybe like this:

Dim ans As String
ans = InputBox(quot;Enter Letterquot;)
Select Case ans
Case quot;Aquot;, quot;Bquot;, quot;Cquot;, quot;Dquot;
'do whatever
Case Else
MsgBox quot;Incorrect Inputquot;
End Select

Hope this helps
Rowan

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


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: www.excelforum.com/member.php...foamp;userid=5141
View this thread: www.excelforum.com/showthread...hreadid=494017

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()