Replacing point with comma using VBA

boggg -  
 Carlguer -
Hello,

For those who know VBA Excel,

I created a very simple macro that selects a sheet and replaces periods with commas,

when we do it "manually" (Edit/Replace, etc.), it works perfectly.

However, with the macro, which indeed describes the action mentioned above, it doesn't work.

For example, for numbers like: 1.27365e+006
the macro transforms them into: 127365000000

Here is the macro, it is very simple:

Sub pv3()

Cells.Select
Application.CutCopyMode = False
Selection.NumberFormat = "General"
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

End Sub

Thank you in advance for your response
Configuration: Windows XP Internet Explorer 6.0

6 answers

  1. Moi
     
    The subject is surely closed, but for those who will need it:

    It is necessary to replace the dot with a dot in the macro. In my case:

    Selection.Replace What:=".", Replacement:=".", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    50
    1. intéressée
       
      Thank you!!!!!!!! It's been a really long time since I've been looking, and the answer isn't obvious... Thanks again for responding to this post, it really comes at the perfect time for me.
      0
    2. Boule de gomme
       
      Thank you, I hadn't found it yet...
      1