+ Reply to Thread
Results 1 to 5 of 5

Simple String Conversion - HELP

  1. #1
    Registered User
    Join Date
    06-09-2005
    Posts
    15

    Simple String Conversion - HELP

    Anyone know off-hand the command to convert a number:

    0000000456

    to:

    4.56

    I tried this:
    Application.FixedDecimal = True
    Application.FixedDecimalPlaces = 2

    Which works, but not if you're copying the data from another workbook.

    Any ideas?


    Garrett (MIS)

  2. #2
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    Dim TempNumber as single

    TempNumber = "000000456"

    TempNumber = TempNumber / 100

  3. #3
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    =VALUE(A1)

    where A1 has your number 000456

    Mangesh

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    in VBA simply do:
    a = Int( "0000456")

    Mangesh

  5. #5
    Registered User
    Join Date
    06-09-2005
    Posts
    15
    hahahaha wow - didn't even occur to me to divide by 100. That makes me laugh.

    Here's something else I came up with if anyone needs it later:

    Sub insertDecimal()

    Dim theInput As String
    theInput = "0000000875"
    Dim leftText, rightText As String

    leftText = left(theInput, Len(theInput) - 2)
    rightText = right(theInput, 2)

    Dim newText

    newText = leftText + "." + rightText

    Cells(1, 1).Value = newText



    End Sub


    thanks for the replies all

+ 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