Thread: Negative number
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Negative number

This works fine

If Sgn(-1) = -1 Or Sgn(-2) - 1 Then
MsgBox "negatives"
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"TJF" wrote in message
...
Thats it.

But there no way to use it like this:

If Sgn(num1) = -1 Or Sgn(num2) = -1 then
....

only way is
If Sgn(num1) = -1 Then ....
If Sgn(num2) = -1 Then ....

thats terible


"Rob van Gelder" píše v diskusním
příspěvku ...
Sgn(x) returns -1 when x is negative

1: Greater than zero
0: Equal to zero
-1: Less than zero


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"TJF" wrote in message
...
How can I recognize (in VB) a number is negative?

num1 = 5
num2 = 7
num3 = -4

If numx = "negative" then
.....



Thanks Tom