如何将小数点更改为小数点逗号?

How do I change decimal dot into decimal comma?

我有一列包含带有混合小数分隔符的数字。

我需要使用“,”作为分隔符。

如何将点号变成逗号?

With ThisWorkbook.Worksheets("RAW").Range("A1")
    .Value = Replace(.Value, ".", ",")
End With

该点存储为文本

有没有办法将其存储为general/numeric?

我试过了

With ThisWorkbook.Worksheets("RAW").Range("A1")
    .NumberFormat = "General"
    .Value = Replace(.Value, ".", ",")
    .NumberFormat = "General"
    .Value = .Value
End With

单个单元格可以通过以下方式快速解决:

.Value = Replace(.Value, ".", ",")*1

或者:

.Value = CSng(Replace(.Value, ".", ","))

如果你碰巧有一个范围要处理,你可以使用:

Sub Test()

With ThisWorkbook.Worksheets("RAW").Range("A1:A3")
    .Replace ".", ","
    .TextToColumns
End With

End Sub

每列:

Sub Test()

With ThisWorkbook.Worksheets("RAW").Range("C2:D4")
    .Replace ".", ","
    For Each col In .Columns
        col.TextToColumns
    Next
End With

End Sub