Sub StoreDateasText()
Dim Cell As Range
Dim s As String
Selection.NumberFormat = "dd/mm/yyyy"
For Each Cell In Selection
With Cell
s = Cell.Text
.NumberFormat = "@"
Cell.ClearFormats
Cell.Value = s
End With
Next Cell
End Sub
INPUT DATA | OUTPUT DATA |
01-03-18 | 03-01-18 |
02-03-18 | 03-02-18 |
03-03-18 | 03-03-18 |
04-03-18 | 03-04-18 |
05-03-18 | 03-05-18 |
06-03-18 | 03-06-18 |
07-03-18 | 03-07-18 |
08-03-18 | 03-08-18 |
09-03-18 | 03-09-18 |
10-03-18 | 03-10-18 |
11-03-18 | 03-11-18 |
12-03-18 | 03-12-18 |
13-03-18 | 13-03-2018 |
14-03-18 | 14-03-2018 |
15-03-18 | 15-03-2018 |
16-03-18 | 16-03-2018 |
17-03-18 | 17-03-2018 |
18-03-18 | 18-03-2018 |
19-03-18 | 19-03-2018 |
20-03-18 | 20-03-2018 |
21-03-18 | 21-03-2018 |
22-03-18 | 22-03-2018 |
23-03-18 | 23-03-2018 |
24-03-18 | 24-03-2018 |
25-03-18 | 25-03-2018 |
26-03-18 | 26-03-2018 |
27-03-18 | 27-03-2018 |
28-03-18 | 28-03-2018 |
29-03-18 | 29-03-2018 |
Let's say that you wanted to save it to cell C1. Then this code snippet would do that:
Code:Range("C1").NumberFormat = "@" Range("C1") = Format(Date, "dd/mm/yyyy")
Sub StoreDateasText()
Dim Cell As Range
Dim s As String
Selection.NumberFormat = "dd/mm/yyyy"
For Each Cell In Selection
With Cell
s = Cell.Text
.NumberFormat = "@"
Cell.Value = s
End With
Next Cell
End Sub