The example test whether a number is between 50 and 100. It first assigns the
value to be tested to a variable "a". In the example, the value of the
selected cell is being tested.
Sub test()
Dim a
a = Selection.Value
If a 50 And a < 100 Then
MsgBox "Hello"
End If
End Sub
Regards,
Edwin Tam
http://www.vonixx.com
"smplogc" wrote:
What's the code to test if a value is between two numbers? I can easily
find the answer for other languages, but not VBA! TIA.
--
smplogc
------------------------------------------------------------------------
smplogc's Profile: http://www.excelforum.com/member.php...o&userid=33887
View this thread: http://www.excelforum.com/showthread...hreadid=537603