vba 如何使用excel vba读取格式化的单元格值数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20995255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 01:15:49  来源:igfitidea点击:

How to read formatted cell value data using excel vba?

excelvbavariablescellformatted

提问by jp0202

What I'm trying to is read formatted cell value in excel 2007 using VBA.

我想要的是使用 VBA 在 excel 2007 中读取格式化的单元格值。

For example I have a cell with value "01/01/2015"and when formatted it looks like Jan/2015. Is there a way to read that formatted value Jan/2015into a variable instead of "01/01/2015"?

例如,我有一个值为"01/01/2015"的单元格,格式化后它看起来像Jan/2015。有没有办法将格式化的值Jan/2015读入变量而不是“01/01/2015”?

Thank you

谢谢

回答by Dmitry Pavliv

try to use

尝试使用

someVariable = Range("A1").Text

instead

反而

someVariable = Range("A1").Value

you can read more here

你可以在这里阅读更多