excel - 将数字从科学记数法转换为文本
问题描述
我尝试了很多方法(.numberformats 等),我无法将这些科学数字(列 [A])转换为文本,以便正确显示 EAN 代码(列 [B])。
我需要一个 VBA 解决方案。
有什么建议么?
编辑:对我有用的解决方案,但我不满意:
For i = 1 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
Range("A" & i).NumberFormat = "@"
Range("A" & i) = Trim(Range("A" & i))
Next i
这将直接将列 [A] 转换为正确的格式。
解决方案
Dim iRowCount As Integer
iRowCount = Cells(Rows.Count, "A").End(xlUp).Row
Range("B2:B" & iRowCount).Value = Range("A2:A" & iRowCount).Value
Range("B2:B" & iRowCount).NumberFormat = "0"
推荐阅读
- python - 为什么 VS 代码显示它是使用 abc 模块的 python 代码的无效语法 - python3.8.0
- keras - EarlyStopping restore_best_weights=真问题
- excel - 如何从 Matlab 将新值添加到 Excel 的下一行?
- java - CountDownTimer 自行随机停止
- javascript - 什么会导致 requestAnimationFrame 返回 undefined 而不是 id?
- asp.net - 从 Request.Form 集合中获取复选框状态和值
- r - 无法渲染动画
- google-cloud-platform - 如果内存超过 90%,则 GCP 刷新 redis
- camunda - 在 Camunda 中,两个选项中优化编码的正确方法是什么?
- asp.net-mvc - 为什么 Html.DisplayFor 显示模型属性名称而不是属性值?