Comparing negative number
Newbie,
Your tests are a bit screwed. For instance
ElseIf bal < 0 And bal (50) Then
will never pass as a variable cannot possibly be less than 0 and greater
than 50, there is no such number. Similarly,
ElseIf bal < (50) And bal (100) Then
is an invalid test.
Describe your different criteria in words, as I would juts be guessing what
they are otherwise.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Newbie" wrote in message
...
Hi
I want to display a message based on the value of a variable but I can't
seem to get the right 'greater than' and 'less than' signs correct for
negative numbers
It doesn't matter what the negative figure is it always goes to the last
line ie. <(100)
What am I doing wrong?
Here is what I have so far:
If bal 100 Then
msg = "Drinks are on you tonight!" & vbCrLf & "But not too many!"
ElseIf bal = 0 And bal < 100 Then
msg = "Things are looking good!"
msgstyle = vbOKOnly
ElseIf bal < 0 And bal (50) Then
msg = "Nearly there!"
msgstyle = vbOKOnly + vbExclamation
ElseIf bal < (50) And bal (100) Then
msg = "No beer for you this week!"
msgstyle = vbOKOnly + vbExclamation
ElseIf bal < (100) Then
msg = "Better ask mom and dad if you can stay for dinner!"
msgstyle = vbOKOnly + vbCritical
End If
|