Skybluekid
Well-known Member
- Joined
- Apr 17, 2012
- Messages
- 1,231
- Office Version
- 365
- Platform
- Windows
Hi All,
I have in column D a list of dates:
[TABLE="width: 102"]
<colgroup><col></colgroup><tbody>[TR]
[TD]43728[/TD]
[/TR]
[TR]
[TD]43710.35417[/TD]
[/TR]
[TR]
[TD]43732[/TD]
[/TR]
[TR]
[TD]43689.62014[/TD]
[/TR]
[TR]
[TD]43698.44236[/TD]
[/TR]
[TR]
[TD]43727[/TD]
[/TR]
[TR]
[TD]43708.5[/TD]
[/TR]
[TR]
[TD]43699[/TD]
[/TR]
</tbody>[/TABLE]
I would like to convert these dates to Text and then format them as dd/mm/yyyy. I hear you cry "this is easy and why are you using VBA???"
Well this is part of a wider chain that copies data from on sheet to a Template. Once this template is complete, it is then exported to a CSV file to be uploaded.
I have used some code from VoG:
Set ColumnFormat = Range("D3:D" & Count)
For Each c In ColumnFormat
c.NumberFormat = "@"
c.Value = Format(c.Value, "dd/mm/yyyy")
Next c
Which does the trick, except when the file has been exported to CSV, it then reverts back to the date number format, as above rather than text. To Transfer the values to Template, I am copying the column and then pasting values
In the Template the Values have to be in the dd/mm/yyyy text format, that can not change.
I would very much welcome some pointers.
I have in column D a list of dates:
[TABLE="width: 102"]
<colgroup><col></colgroup><tbody>[TR]
[TD]43728[/TD]
[/TR]
[TR]
[TD]43710.35417[/TD]
[/TR]
[TR]
[TD]43732[/TD]
[/TR]
[TR]
[TD]43689.62014[/TD]
[/TR]
[TR]
[TD]43698.44236[/TD]
[/TR]
[TR]
[TD]43727[/TD]
[/TR]
[TR]
[TD]43708.5[/TD]
[/TR]
[TR]
[TD]43699[/TD]
[/TR]
</tbody>[/TABLE]
I would like to convert these dates to Text and then format them as dd/mm/yyyy. I hear you cry "this is easy and why are you using VBA???"
Well this is part of a wider chain that copies data from on sheet to a Template. Once this template is complete, it is then exported to a CSV file to be uploaded.
I have used some code from VoG:
Set ColumnFormat = Range("D3:D" & Count)
For Each c In ColumnFormat
c.NumberFormat = "@"
c.Value = Format(c.Value, "dd/mm/yyyy")
Next c
Which does the trick, except when the file has been exported to CSV, it then reverts back to the date number format, as above rather than text. To Transfer the values to Template, I am copying the column and then pasting values
In the Template the Values have to be in the dd/mm/yyyy text format, that can not change.
I would very much welcome some pointers.