Search code examples
exceldate-formatsemanticsvba

what does the "@" sign means in the end of date format in Excel VBA?


what does the "@" sign means in the end of date format in Excel VBA ?

Columns("U:U").NumberFormat = "yyyy-mm-dd hh:mm:ss;@"
Columns("V:V").NumberFormat = "yyyy-mm-dd hh:mm:ss;@"

does it do anything?

what is the difference if I had wrote .NumberFormat without it?

Columns("U:U").NumberFormat = "yyyy-mm-dd hh:mm:ss;
Columns("V:V").NumberFormat = "yyyy-mm-dd hh:mm:ss;

my other columns formats are writen without that sign in the end:

Columns("K:K").NumberFormat = "#,##0"        
Columns("L:L").NumberFormat = "General"
Columns("M:M").NumberFormat = "#,##0.00"
Columns("N:N").NumberFormat = "General"
Columns("O:O").NumberFormat = "#,##0.00"

Solution

  • It's because it's a custom text -a date followed by time-, the "@" means text. If you don't set it this happens enter image description here How Excel interface would know what are you trying to do from VBA?