Thread: Negative number
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Negative number

Hi
try
If (Sgn(num1) = -1) Or (Sgn(num2) = -1) then
....
end if

should work
Frank

TJF wrote:
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