T

#### TJF

num1 = 5

num2 = 7

num3 = -4

If numx = "negative" then

......

Thanks Tom

T

num1 = 5

num2 = 7

num3 = -4

If numx = "negative" then

......

Thanks Tom

Ad

R

If numx < 0

?

?

R

Sgn(x) returns -1 when x is negative

1: Greater than zero

0: Equal to zero

-1: Less than zero

1: Greater than zero

0: Equal to zero

-1: Less than zero

T

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

B

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)

F

Hi

try

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

....

end if

should work

Frank

try

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

....

end if

should work

Frank

Ad

T

Do you know how can I change data declaration?

I know this

new = CDbl(old)

but I need something like this:

old = CDbl(old)

....but this of course dosnt work

is there something like this

old = set as double

F

Hi

AFAIK it is not possible to change the variable's data type during

runtime

Frank

AFAIK it is not possible to change the variable's data type during

runtime

Frank

B

old = CDbl(Range("A1").Value)

--

HTH

Bob Phillips

... looking out across Poole Harbour to the Purbecks

(remove nothere from the email address if mailing direct)

T

My problem is I have numx as Textbox and then this:

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

dosnt work so only way for me is:

num1_new = CLng(num1)

num2_new = CLng(num2)

If Sgn(num1_new) = -1 Or Sgn(num2_new) = -1 then

is that?

B

Sgn(CDbl(TextBox1.Text))

--

HTH

Bob Phillips

... looking out across Poole Harbour to the Purbecks

(remove nothere from the email address if mailing direct)

Ad

T

I tried this but VB said:

Type mismatch

Type mismatch

B

problem. Sorry.

--

HTH

Bob Phillips

... looking out across Poole Harbour to the Purbecks

(remove nothere from the email address if mailing direct)

Ad

R

things, it's not a number.

**Want to reply to this thread or ask your own question?**

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.