Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

problem with double value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jlorga - 28 Feb 2006 15:02 GMT
I have a xml document, and one of it's values is a number in the format
1,5. And i need to insert in a excel cell that value * an integer, the
problem is that when i convert 1,5 to double i got 15 instead of 1.5. I
tried modifying the format of the number to 1.5 or replacing the , with
a . but with no success. If i don't convert the number to double i got
only 1.

Now i convert 1.5 to 15 and then multiply it by the integer and then
divide it by 10. It works, but it's not elegant, and the thing is that
in the xml document i can have 1,5 or an integer, and in that case i
can't divide by 10. So i need to compare the number in search of a ,
before converting it.

Is there any way around more elegant?

Thanks,

Signature

Jlorga

davesexcel - 28 Feb 2006 15:21 GMT
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 2/28/2006 by Dave
'

'
Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
ActiveCell.Offset(0, 0).Range("A1").Select
End Sub

I just copied this macro from the recorder, insert it into a module and
assign a button to it,
highlite a range you want edited and then press the button

Signature

davesexcel

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.