ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   removing commas from a string (https://www.excelbanter.com/excel-programming/348403-removing-commas-string.html)

TheIrishThug[_3_]

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, ",", "")


--
TheIrishThug
------------------------------------------------------------------------
TheIrishThug's Profile: http://www.excelforum.com/member.php...o&userid=29682
View this thread: http://www.excelforum.com/showthread...hreadid=494444


Chip Pearson

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"
wrote
in message
...

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




Bob Phillips[_6_]

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"
wrote in message
...

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




Gary Keramidas

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"
wrote in message
...

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




TheIrishThug[_4_]

removing commas from a string
 

hmm, it works now. thanks for the help. and no, i'm running i have
office 03


--
TheIrishThug
------------------------------------------------------------------------
TheIrishThug's Profile: http://www.excelforum.com/member.php...o&userid=29682
View this thread: http://www.excelforum.com/showthread...hreadid=494444



All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com