+ Reply to Thread
Results 1 to 2 of 2

problem with double value

  1. #1
    Registered User
    Join Date
    02-18-2006
    Posts
    7

    problem with double value

    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,

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Red face

    Sub Macro3()
    '
    ' Macro3 Macro
    ' Macro recorded 2/28/2006 by Dave
    '

    On Error Resume Next

    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
    Last edited by davesexcel; 02-28-2006 at 11:25 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1