PDA

View Full Version : Easiest way to write greater or less than?



doctortt
04-18-2011, 08:53 PM
Is there any easy, clean way to write this?

if a is not less than b and b is not less than c, throw out an error message?

GTO
04-18-2011, 11:24 PM
Does this work?

Sub exa()
Dim a As Long, b As Long, c As Long

Randomize
a = Int((10 * Rnd) + 1)
b = Int((10 * Rnd) + 1)
c = Int((10 * Rnd) + 1)

MsgBox "a= " & a & vbCrLf & "b= " & b & vbCrLf & "c= " & c & String(2, vbCrLf) & _
(a < b And b < c)
End Sub

Bob Phillips
04-19-2011, 02:34 AM
Do you mean easier than



If a >= b and b >= c Then

Msgbox ...

If so, what is hard about that?