PC Review


Reply
Thread Tools Rate Thread

Change variable value of -1 to 1

 
 
Les Stout
Guest
Posts: n/a
 
      11th Jul 2007
Hello all, could somebody please tell me how to do the above in my code,
i am subtracting two dates and get a - value and would like to remove
the minus. My variable is long.



Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      11th Jul 2007
myVar = Abs(myVar)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Les Stout" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello all, could somebody please tell me how to do the above in my code,
> i am subtracting two dates and get a - value and would like to remove
> the minus. My variable is long.
>
>
>
> Best regards,
>
> Les Stout
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      11th Jul 2007
Just multiply the value by -1 to switch signs:

V = V * -1

To ensure it is always negative, use

V = Abs(V) * -1


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Les Stout" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello all, could somebody please tell me how to do the above in my code,
> i am subtracting two dates and get a - value and would like to remove
> the minus. My variable is long.
>
>
>
> Best regards,
>
> Les Stout
>
> *** Sent via Developersdex http://www.developersdex.com ***


 
Reply With Quote
 
=?Utf-8?B?TWlrZSBI?=
Guest
Posts: n/a
 
      11th Jul 2007
Try

x = -1
x = Abs(x)

Mike

"Les Stout" wrote:

> Hello all, could somebody please tell me how to do the above in my code,
> i am subtracting two dates and get a - value and would like to remove
> the minus. My variable is long.
>
>
>
> Best regards,
>
> Les Stout
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
Les Stout
Guest
Posts: n/a
 
      11th Jul 2007
I have solved it with the following thanks you...

dteDiff = Abs(dteDiff)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Les Stout
Guest
Posts: n/a
 
      11th Jul 2007
Thank you all for the input, much appreciated... :0)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change it to a variable alvin Kuiper Microsoft Excel Programming 7 18th May 2009 06:56 PM
? value input of one variable change options on second variable? =?Utf-8?B?VGVkRHVzaGFuZQ==?= Microsoft Access Form Coding 1 7th May 2005 05:43 AM
change value of a variable =?Utf-8?B?Sm9zZW1h?= Microsoft C# .NET 1 13th Oct 2004 04:53 PM
Change name of variable Arjen Microsoft C# .NET 2 23rd May 2004 05:36 AM
change in Variable Value Varadha Microsoft VC .NET 1 25th Sep 2003 03:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:15 AM.