
Sep 15th, 2002, 04:17 PM
#1
Thread Starter
Member
Make a Positive Number  Negative
How do i make a positive number which is assigned to a variable, a negative one.
So
PA = (Aptelev)  (intDiffQ)
If intDiffQ was positive, how do i make it negative before storing it in PA. Is there a Function to it?
the reason I ask is because sometimes the value of Aptelev is 12 and the value of intDiffQ is Positive. I want the answer to be positive but i keep getting a negative number!
Any ideas?

Sep 15th, 2002, 04:19 PM
#2
Member
if number > 0 then number = number * 1

Sep 15th, 2002, 05:09 PM
#3
PowerPoster
well, math is a lot like that. If you subtract a negative number from a negative number, you'll get a negative number.
sounds like what you want is the absolute value. see "abs" function

Sep 15th, 2002, 05:14 PM
#4
Addicted Member
Hmm, you know actually that isn't true:
(4)  (8) = +4
But I'm sure you knew that...
Not at all related to sheep...

Sep 15th, 2002, 05:20 PM
#5
PowerPoster
hm ... I seem to have had a brain fart on that one

Sep 15th, 2002, 05:56 PM
#6
Frenzied Member
you can make a number negative just by multiplying it with 1 or just puttiing  sign before the variable..

Sep 15th, 2002, 06:00 PM
#7
The picture isn't missing
Originally posted by moinkhan
you can make a number negative just by multiplying it with 1 or just puttiing  sign before the variable..
that will only work if the number = positive
(5) = 5
(5) = 5
a = 5
a = 5
Remember, if someone's post was not helpful, you can always rate their post negatively .

Sep 15th, 2002, 06:28 PM
#8
PowerPoster
sounds like what you want is the absolute value. see "abs" function

Sep 15th, 2002, 11:10 PM
#9
PowerPoster
If you can't do simple addition/subtraction, maybe you should choose a new career track...

RJ
rjlohan@alumni.uts.edu.au


Sep 16th, 2002, 03:12 AM
#10
Hyperactive Member
if i understand you right you want this
intDiffQ = intDiffQ  (intDiffQ * 2)
We don't know what's wrong. . . So the best bet might be to remove something surgically.

Sep 16th, 2002, 05:33 AM
#11
Fanatic Member
If intNumber is a variable that contains either a negative or positive value then:
VB Code:
intNegativeNumber =  Abs(intNumber)
intNegativeNumber will always contain the negative value.
Martin J Wallace (Slaine)
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
Survey posted by VBForums.
