我有两台电脑,当我在两台电脑上打开同一个 Excel 时,它们显示的数字不同。它看起来像这样:
第一个显示数字135.05
,而另一个显示135.059.003.051.757,00
。两台 PC 具有相同的设置,如下所示:
有谁知道任何其他可能会让我搞砸的设置?
在后台运行了很多宏,我认为这可能会导致问题。每当工作表更改或激活或在开始时打开时都会调用它。该宏的任务是转换“数字存储为字符串”:
Public Function remove_numbers_formated_as_text(ByVal sh As Worksheet)
Dim r As Range
Dim arr As Variant
Dim i As Long '''' arr's rows
Dim j As Long '''' arr's columns
Dim s As String
Dim b As Boolean
Set r = sh.ListObjects(1).DataBodyRange
arr = r.Formula2
'''' Iterate over a whole row and then proceed to next column
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
If IsEmpty(arr(i, j)) = False Then
'''' Check whether array mamber stores formula
b = r(i, j).HasFormula
If b = True Then GoTo A
'''' If cell doesn't treat numbers as text and is a numeric value,
'''' then this is definitely a measurement that somebody entered and
'''' it is therefore converted to double.
s = r(i, j).NumberFormat
If IsNumeric(arr(i, j)) And s <> "@" Then
arr(i, j) = CDbl(arr(i, j))
End If
End If
A:
Next
Next
r.Formula2 = arr
End Function