VBA:复制之前,前一个零下降 [英] VBA: preceding zeros dropped when copied over

查看:121
本文介绍了VBA:复制之前,前一个零下降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VBA创建一个Excel文件的副本。在文件中,有一列包含前面零的数字。创建文件的副本,但是该列中的数据将被删除。我需要保留前面的零的值。如何使用VBA解决此问题?

解决方案

将该列中的每个单元格转换为文本字段,然后再导出。这应该确保每个角色都被保留(而不是像一个数字那样对待,这听起来正在发生)。


I am creating a copy of an Excel file using VBA. In the file, there is a column that includes numbers with preceding zeros. The copy of the file is created, but the data in this column is dropped. I need to keep the values with the preceding zeros. How can I resolve this problem with VBA?

解决方案

Convert each cell in that column to a text field prior to exporting it. That should ensure that every character is retained (and not treated like a number, which is what it sounds like is happening).

这篇关于VBA:复制之前,前一个零下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆