We help IT Professionals succeed at work.
Get Started

Check VBA Macro (follow-up)

Last Modified: 2019-12-13
Hello hello,

I think I shouldnt have "marked as solution" as a thanks for your help on this topic

... as I couldnt add my file to answer Martin question

And this question interests me because I think Martin has something interesting regarding my regional settings and so on.

So, I'll remind my both codes and attach a picture of a typical result. If you see any way to standardize this so that it will work on most machines and most settings to avoid headaches to get our formats rights, it will be very welcome !

Sub TextToNumbers()
    ' ToNumbers Macro
    ' Converts the selected column to numbers (when text stored as numbers)
    Range(Selection, Selection.End(xlDown)).Select
    With Selection
        Selection.NumberFormat = General
        .Value = .Value
    End With
End Sub

Open in new window

Sub ToNumbers()
    Range(Selection, Selection.End(xlDown)).Select
    With Selection
        Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _
                          SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    End With
    Range(Selection, Selection.End(xlDown)).Select
    With Selection
        Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
    End With
End Sub

Open in new window

Watch Question
Keep everyone healthy; Wear a mask - Social distance - Don't touch your face - Wash your hands for 20 seconds
Most Valuable Expert 2017
Distinguished Expert 2020
This problem has been solved!
Unlock 3 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE