简体   繁体   English

在Excel VBA中以毫秒为单位复制日期

[英]copying date with milliseconds in excel vba

I would like to copy the exact date contained in one cell to another cell. 我想将一个单元格中包含的确切日期复制到另一个单元格中。 I use this command: 我使用以下命令:

Range("E" & ii).Value = Range("C" & ii).Value

but the date format is missing the milliseconds despite having the column formatted using: 但是,尽管使用以下格式对列进行了格式化,但日期格式仍缺少毫秒数:

Columns("E:E").Select
Selection.NumberFormat = "dd/mm/yyyy hh:mm:ss.0"

I get "0" millisecond always in E column despite having a millisecond value in C column. 尽管C列中有毫秒值,但我总是在E列中获得“ 0”毫秒。

thanks and regards 谢谢并恭祝安康

Use this format: 使用以下格式:

"dd/mm/yyyy hh:mm:ss.000" “ dd / mm / yyyy hh:mm:ss.000”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM