Results 1 to 10 of 10

Decimal moving and values lost when converting from string

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-14-2007
    Location
    Chester, England
    MS-Off Ver
    2010 & 2016
    Posts
    312

    Decimal moving and values lost when converting from string

    Hi All

    This is driving me mad, I'm hoping I someone can help.

    I have written a script that re-formats a data set; part of it takes a text string, removes the leading characters and then displays the remaining numbers. I had just left it as text but it now needs to be shown as a value with 2 decimal places.........this is where the problems started.......

    When I convert to a value it drops the decimal values.

    I am in the UK on a UK machine but the script is for a user in the Netherlands. I have changed the location settings on my machine and am using Dutch formatted data to test.

    I have put an example of what is happening is below,

    Starting Value: AUD29.442,72

    After this script: (where c is each cell in a given range) (I have selected each cell as it seemed to be the only way to get it to show as a number.)

    c.Select
    c.Value = Right(c.Value, Len(c) - 3)
    Selection.NumberFormat = "#,##0.00"
    c.Value = Val(c)

    Resulting Value: 29,442

    Just wondering if anyone can either spot something I have done wrong or suggest a resolution.

    Thanks in advance

    Cheers

    Jim
    Last edited by JimmyA; 11-28-2012 at 04:59 PM.

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