troubleshooting Question

Check VBA Macro (follow-up)

Avatar of Magpie Bavarde
Magpie BavardeFlag for France asked on
VBAMicrosoft ExcelMicrosoft Office
9 Comments3 Solutions59 ViewsLast Modified:
Hello hello,

I think I shouldnt have "marked as solution" as a thanks for your help on this topic
https://www.experts-exchange.com/questions/29166939/Check-VBA-Macro-3.html

... 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 !

Format-Macros.png
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

Sub ToNumbers()
    Range(Selection, Selection.End(xlDown)).Select
    With Selection
        Selection.Replace What:=",", Replacement:=".", LookAt:=xlPart, _
                          SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
                          ReplaceFormat:=False
    End With
    Range(Selection, Selection.End(xlDown)).Select
    With Selection
        Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
    End With
End Sub
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros