Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default CDbl function

Can some one please explain how the CDbl conversion function works. I
have it in this code:

cell.Value = CDbl(sVal)

which converts 2000- to -2000.

How does this happen?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CDbl function

for some reason, the person who programmed the cdbl conversion function put
in code to recognize a trailing hypen as a negative unary operator and so
interpret it. Beyond that, you would have to talk to the developers.

? cdbl("1200-")
-1200
? clng("1200-")
-1200
? cint("1200-")
-1200
? csng("1200-")
-1200
? cdec("1200-")
-1200



--
Regards,
Tom Ogilvy

"snax500" wrote in message
om...
Can some one please explain how the CDbl conversion function works. I
have it in this code:

cell.Value = CDbl(sVal)

which converts 2000- to -2000.

How does this happen?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default CDbl function

You have a function some one has developed for you. Check
Your macro to locate the function. If you do not find it
in your macro look for other references that yourmacro is
making one of your references has the function built into
it.

Off hand I would say it is so some thing of the sorts...

Dim suffix as string
suffix = right(var,len(var)-1)
NewVar = suffix & left(var,len(var)-1)

hope that helps,
-Neil


-----Original Message-----
Can some one please explain how the CDbl conversion

function works. I
have it in this code:

cell.Value = CDbl(sVal)

which converts 2000- to -2000.

How does this happen?

Thanks
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default CDbl function

Actually, I took this from Tom's code when he posted it this week. I
just wanted someone to explain the "CDbl" function to me. I looked it
up in the help but I did not understand the explanation:

-1.79769313486231E308 to
-4.94065645841247E-324 for negative values; 4.94065645841247E-324 to
1.79769313486232E308 for positive values.


Thanks

For Each cell In Selection.SpecialCells( _
xlConstants, xlTextValues)
sVal = Trim(cell.Value)
If Right(sVal, 1) = "-" Then
cell.NumberFormat = "General"
cell.Value = CDbl(sVal)
End If
Next




wrote in message ...
You have a function some one has developed for you. Check
Your macro to locate the function. If you do not find it
in your macro look for other references that yourmacro is
making one of your references has the function built into
it.

Off hand I would say it is so some thing of the sorts...

Dim suffix as string
suffix = right(var,len(var)-1)
NewVar = suffix & left(var,len(var)-1)

hope that helps,
-Neil


-----Original Message-----
Can some one please explain how the CDbl conversion

function works. I
have it in this code:

cell.Value = CDbl(sVal)

which converts 2000- to -2000.

How does this happen?

Thanks
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default CDbl function

double is a data type.

cdbl converts its argument to that type (a double).

The information you show tells you what size numbers can be stored in a
variable of type double.

--
Regards,
Tom Ogilvy

"snax500" wrote in message
om...
Actually, I took this from Tom's code when he posted it this week. I
just wanted someone to explain the "CDbl" function to me. I looked it
up in the help but I did not understand the explanation:

-1.79769313486231E308 to
-4.94065645841247E-324 for negative values; 4.94065645841247E-324 to
1.79769313486232E308 for positive values.


Thanks

For Each cell In Selection.SpecialCells( _
xlConstants, xlTextValues)
sVal = Trim(cell.Value)
If Right(sVal, 1) = "-" Then
cell.NumberFormat = "General"
cell.Value = CDbl(sVal)
End If
Next




wrote in message

...
You have a function some one has developed for you. Check
Your macro to locate the function. If you do not find it
in your macro look for other references that yourmacro is
making one of your references has the function built into
it.

Off hand I would say it is so some thing of the sorts...

Dim suffix as string
suffix = right(var,len(var)-1)
NewVar = suffix & left(var,len(var)-1)

hope that helps,
-Neil


-----Original Message-----
Can some one please explain how the CDbl conversion

function works. I
have it in this code:

cell.Value = CDbl(sVal)

which converts 2000- to -2000.

How does this happen?

Thanks
.





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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 11:23 AM.

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"