![]() |
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 |
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 |
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 . |
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 . |
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 . |
All times are GMT +1. The time now is 03:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com