VBA改变科学价值格式
我有这个代码,它按预期工作。 除了给出错误和不可用的结果。
Sub OpenXLS1() Dim strFile As String Dim strXLS As String strFile = ActiveWorkbook.Path strXLS = "results.xls" Workbooks.Open strFile & "\" & strXLS Range("A1").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("A2") Range("A1330").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("B4") Range("A2661").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("C1") Range("A3989").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("D2") Range("A5318").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("E2") Range("A6647").CurrentRegion.Copy Destination:=Workbooks("Machine.xlsm").Sheets("Import").Range("F2") Workbooks(strXLS).Close End Sub
results.xls文件具有通用(即0,000145958
)和科学格式(即6,83E-05
)的值。 运行脚本后,我得到以下结果:
0,000145958
已成为0,000145958184
只有它被格式化为文本,我不能在更多的公式中使用它。
6,83E-05
已经变成了6,83E+03
,这是超级6,83E+03
的。
非常感谢您的帮助!