I would like to convert a date cell with the syntax YYYY-MM-DD to a text cell reading just "YYMMDD" and not the counter number 38720. Anyone have a good clue for a swedish novice...
Dates are numbers, just shown with date format. YOu shouldn't need any code for this (well, record it if you need), just hit ctrl+1 (format | cells), then in the custom category (lowest), enter the sweedish format string ([å][å]mdd?)
I understand that I can convert the cell with the custom category. But I'm going to put this string in a small program and compare it to a file name looking like this 060103.xls. Would it work anyway or would excel use the hidden 38720?
I would leave the format alone because regardless of the format, the value of the cell is the timevalue relating to the date entered (in your example the value of the cell is "38720").
After a good deal of research on the Internet. I did it like this. Little of the code is with help from the macro-recorder. I suppose the code could be more sophisticated.
Thanx,
Roger
Sub Kopiera()
'Skrivet av Roger Håkanson
'
' Join today´s date with ".xls"
' Format the filnamn to match visitor files syntax
Dim filnamn As String
filnamn = Format(Now() - 2, "yymmdd") & ".xls"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.