Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default ABS Excel Function

Hi
ABS excel function is not available in Visual Basic.
What code should I write in order to give me the absolute number

Regards
PEdro


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ABS Excel Function

Pedro,

Use the Abs VB function

myVar=Abs(-50.3)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Pedro" wrote in message
...
Hi
ABS excel function is not available in Visual Basic.
What code should I write in order to give me the absolute number

Regards
PEdro




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ABS Excel Function

ABS is a VBA function (see Walkenbach, -Excel 2002 PowerProgramming-,
page 871)

Just to test it, try this: put a number in cell F6, then use this code
to put absolute value into F7. (Shorter way to do this, but gives you
the idea).


Code:
--------------------

Sub Test()
Dim i As Integer
i = Range("F6").Value
Range("F7").Value = Abs(i)
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ABS Excel Function

if you dont want to use the function then

dim x as double
dim abs as double

if x < 0 then
abs = x * -1
else
abs = x
endif

Keith
www.kjtfs.com

shades wrote:
[b]ABS is a VBA function (see Walkenbach, -Excel 200
PowerProgramming-, page 871)

Just to test it, try this: put a number in cell F6, then use thi
code to put absolute value into F7. (Shorter way to do this, bu
gives you the idea).


Code
-------------------

Sub Test()
Dim i As Integer
i = Range("F6").Value
Range("F7").Value = Abs(i)
End Sub

-------------------
[/B


--
Message posted from http://www.ExcelForum.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
Excel Data Validation/Lookup function does function correcty Kirkey Excel Worksheet Functions 2 May 25th 09 09:22 PM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM
When I Import an Access Table With an Excel Function in a Cell it Displays as Text not as a Function in Excel Niek Otten Excel Programming 2 September 18th 03 03:55 AM
Excel - saving result of a function without showing the function Moshe Excel Programming 1 August 30th 03 08:41 PM


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

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

About Us

"It's about Microsoft Excel"