replacing , with nothing ?

G

Guest

I have written below code to get rid of commas (,). But the problem is that
it does not work.

Data looks like this:

249,29 (screen)

249,291 (in the cell)

I want it to look like this (after the comma is removed...)

249291



Sub test()
'

Columns("G:G").EntireColumn.Select
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
 
S

Susan

i used the macro recorder & it worked that way.
xxxxxxxxxxxxx
Sub test()
'
' test Macro
' Macro recorded 10/30/2006 by Susan

Columns("G:G").Select
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

End Sub
xxxxxxxxxxxxxxxxxxx
the code looks the same - don't know why yours isn't working.
susan
 
G

Guest

You can replace only in strings! The number in your example seems to be a
real Excel number with a comma as decimal separator. You have first convert
it to a string and after that you can remove the comma:

=SUBSTITUTE(TEXT(A1,"@"),",","")

Regards,
Stefi

„sverre†ezt írta:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top