+ Reply to Thread
Results 1 to 5 of 5

removing commas from a string

  1. #1
    Registered User
    Join Date
    12-15-2005
    Posts
    23

    Question removing commas from a string

    i need to make "1,458,685" into "1458685
    i found Replace() on a website and assumed leaveing the last paramater empty would work. it doesn't

    this is what i was trying:
    PrizePool = Replace(PrizePool, ",", "")

  2. #2
    Chip Pearson
    Guest

    Re: removing commas from a string

    The following works:

    Dim S As String
    Dim R As String
    S = "123,456"
    R = Replace(S, ",", "")
    Debug.Print R


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "TheIrishThug"
    <TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com> wrote
    in message
    news:TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com...
    >
    > i need to make "1,458,685" into "1458685
    > i found Replace() on a website and assumed leaveing the last
    > paramater
    > empty would work. it doesn't
    >
    > this is what i was trying:
    > PrizePool = Replace(PrizePool, ",", "")
    >
    >
    > --
    > TheIrishThug
    > ------------------------------------------------------------------------
    > TheIrishThug's Profile:
    > http://www.excelforum.com/member.php...o&userid=29682
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=494444
    >




  3. #3
    Bob Phillips
    Guest

    Re: removing commas from a string

    That should work. Where is PrizePool declared, and what is stored in it?

    Also, you don't have Excel97 do you?

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "TheIrishThug" <TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com>
    wrote in message
    news:TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com...
    >
    > i need to make "1,458,685" into "1458685
    > i found Replace() on a website and assumed leaveing the last paramater
    > empty would work. it doesn't
    >
    > this is what i was trying:
    > PrizePool = Replace(PrizePool, ",", "")
    >
    >
    > --
    > TheIrishThug
    > ------------------------------------------------------------------------
    > TheIrishThug's Profile:

    http://www.excelforum.com/member.php...o&userid=29682
    > View this thread: http://www.excelforum.com/showthread...hreadid=494444
    >




  4. #4
    Gary Keramidas
    Guest

    Re: removing commas from a string

    something like this should work

    Option Explicit
    Sub test()
    Dim cell As Range
    Dim rng As Range
    Set rng = Range("PrizePool")

    For Each cell In rng
    cell.Value = Replace(cell.Value, ",", "")
    Debug.Print cell.Value
    Next

    End Sub

    --


    Gary


    "TheIrishThug" <TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com>
    wrote in message
    news:TheIrishThug.208wqm_1134925801.689@excelforum-nospam.com...
    >
    > i need to make "1,458,685" into "1458685
    > i found Replace() on a website and assumed leaveing the last paramater
    > empty would work. it doesn't
    >
    > this is what i was trying:
    > PrizePool = Replace(PrizePool, ",", "")
    >
    >
    > --
    > TheIrishThug
    > ------------------------------------------------------------------------
    > TheIrishThug's Profile:
    > http://www.excelforum.com/member.php...o&userid=29682
    > View this thread: http://www.excelforum.com/showthread...hreadid=494444
    >




  5. #5
    Registered User
    Join Date
    12-15-2005
    Posts
    23
    hmm, it works now. thanks for the help. and no, i'm running i have office 03

+ 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