VBA 无法在列上设置日期格式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9111038/
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-11 15:08:07  来源:igfitidea点击:

VBA can't set date format on column

excel-vbavbaexcel

提问by cinemarter

i'm trying to change column format from "Custom" to "Date" by

我正在尝试将列格式从“自定义”更改为“日期”

Columns("F:F").Select
Selection.NumberFormat = "Date"

but it set's F column's format just to another Custom, and for example

但它将 F 列的格式设置为另一个自定义,例如

05 / 16

becomes to

变成

1at2016

Can you please help me?

你能帮我么?

回答by Romeo

Selection.NumberFormat = "mm/dd"

that should do the trick.

这应该够了吧。