ThrottleWorks
Excel Ninja
Hi,
I have value as '27/08/2015 14:46:17' in a column.
I am trying to convert it to 27/08/2015 however after applying format the values are changing.
For example '05/09/2015 14:46:17' is getting changed to '09/05/2015 14:46:17'.
Can anyone please help me this.
If we manually delimit the value it's working but if we try the same with macro it does not work.
That is why I tried deriving year, month and day in separate column.
Till " Sht1.Range("c2").Formula = "=D2&""/""&E2&""/""&F2"" this line it's working nice but when I apply "Columns("C:C").NumberFormat = "m/d/yyyy" format then somehow month changes to day and day changes to month.
I have value as '27/08/2015 14:46:17' in a column.
I am trying to convert it to 27/08/2015 however after applying format the values are changing.
For example '05/09/2015 14:46:17' is getting changed to '09/05/2015 14:46:17'.
Can anyone please help me this.
If we manually delimit the value it's working but if we try the same with macro it does not work.
That is why I tried deriving year, month and day in separate column.
Till " Sht1.Range("c2").Formula = "=D2&""/""&E2&""/""&F2"" this line it's working nice but when I apply "Columns("C:C").NumberFormat = "m/d/yyyy" format then somehow month changes to day and day changes to month.
Code:
Sht1.Range("d2").Formula = "=DAY(B2)"
Sht1.Range("d2: d" & TempLr).Formula = Sht1.Range("d2").Formula
Sht1.Range("d2: d" & TempLr).Value = Sht1.Range("d2: d" & TempLr).Value
Sht1.Range("e2").Formula = "=MONTH(B2)"
Sht1.Range("e2: e" & TempLr).Formula = Sht1.Range("e2").Formula
Sht1.Range("e2: e" & TempLr).Value = Sht1.Range("e2: e" & TempLr).Value
Sht1.Range("f2").Formula = "=YEAR(B2)"
Sht1.Range("f2: f" & TempLr).Formula = Sht1.Range("f2").Formula
Sht1.Range("f2: f" & TempLr).Value = Sht1.Range("f2: f" & TempLr).Value
Columns("d:f").NumberFormat = "0"
Sht1.Range("c2").Formula = "=D2&""/""&E2&""/""&F2"
Sht1.Range("c2: c" & TempLr).Formula = Sht1.Range("c2").Formula
Sht1.Range("c2: c" & TempLr).Value = Sht1.Range("c2: c" & TempLr).Value
Columns("C:C").NumberFormat = "m/d/yyyy"
Last edited: