Replace with Macros

F

frpascal

Hi folks,

I need to replace the "," by a "." in many cells to fit another country
decimal separation. My regional parameters use normally ",".

When I do it into Excel with the replace function it is ok and produce the
macro script :

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

But when I run the macro it change nothing and keep the ","

Thanks for any help !
Pascal
 
J

Jim Cone

Does your data actually contain "," or just formatted to display them?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"frpascal"
wrote in message
Hi folks,
I need to replace the "," by a "." in many cells to fit another country
decimal separation. My regional parameters use normally ",".

When I do it into Excel with the replace function it is ok and produce the
macro script :

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

But when I run the macro it change nothing and keep the ","
Thanks for any help !
Pascal
 
F

frpascal

The data contains ",".
I found a "solution" :

Price = Worksheets("TRU").Cells(J, 6).Value
entier = Int(Price)
reste = (Price - entier) * 100
Dim chiffr As String
chiffr = Format(entier, 0) + "." + Format(reste, 0)
Worksheets("SEND").Cells(Ind, 10).NumberFormat = "@"
Worksheets("SEND").Cells(Ind, 10) = chiffr

It's not very nice but it works. I'll prefer a Replace function...

Thanks for your help
Pascal
 

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