Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Change variable value of -1 to 1

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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change variable value of -1 to 1

myVar = Abs(myVar)

--
HTH

Bob

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

"Les Stout" wrote in message
...
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 ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Change variable value of -1 to 1

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" wrote in message
...
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 ***


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Change variable value of -1 to 1

I have solved it with the following thanks you...

dteDiff = Abs(dteDiff)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Change variable value of -1 to 1

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 ***



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Change variable value of -1 to 1

Thank you all for the input, much appreciated... :0)

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type change in a declared Variable? NickHK Excel Programming 1 December 14th 06 02:01 AM
change firstrow variable to be the 2nd row value instead of the fi Janis Excel Programming 1 September 11th 06 07:23 PM
Change variable permanently Arne Hegefors Excel Programming 4 August 28th 06 01:10 PM
Sheets reference change variable Francois via OfficeKB.com Excel Programming 3 June 15th 06 12:50 PM
change the number of rows to a variable minrufeng[_6_] Excel Programming 2 August 15th 05 10:03 PM


All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"