Avatar of Magpie Bavarde
Magpie Bavarde
Flag for France

asked on 

Check VBA Macro (follow-up)

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

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, _
                          ReplaceFormat:=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

VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Magpie Bavarde

8/22/2022 - Mon