1. Highlight all the datesI have a row from H8 to BC8 in this format, is there aw way vba code to convert it to dd-mm-yyyy
24/06/22, 00:00 24/06/22, 01:00 24/06/22, 02:00 24/06/22, 03:00 24/06/22, 04:00 24/06/22, 05:00
I see, think I’ve had this before with a report produced from a HR system.Hi Chris and Lighting i tried both of your methods but non is working out for me.
it is still giving me the sale result as 24/06/22, 00:00 no change.
Hi please find attached.I see, think I’ve had this before with a report produced from a HR system.
Can you upload the sheet via XL2BB and I can look at it
XL2BB - Excel Range to BBCodeHi please find attached.
20230619 DateTime Conversion vmjam02.xlsx | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | |||||||||
2 | Original Line (looks to be text) ---> | 24/06/22, 00:00 | 24/06/22, 01:00 | 24/06/22, 02:00 | 24/06/22, 03:00 | ||||
3 | |||||||||
4 | |||||||||
5 | Converted to Date Time ---> | 24-06-2022 00:00 | 24-06-2022 01:00 | 24-06-2022 02:00 | 24-06-2022 03:00 | ||||
6 | (Applied custom format of dd-mm-yyyy hh:mm) | ||||||||
7 | |||||||||
8 | Converted to Date Text ---> | 24-06-2022 00:00 | 24-06-2022 01:00 | 24-06-2022 02:00 | 24-06-2022 03:00 | ||||
9 | |||||||||
10 | |||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C5:F5 | C5 | =--(SUBSTITUTE(C2,",","")) |
C8:F8 | C8 | =TEXT(--(SUBSTITUTE(C2,",","")),"dd-mm-yyyy hh:mm") |
Sub TO_DATE1()
Dim c As Range
For Each c In Range("H8:M8")
If Len(c) > 7 Then c = CDate(Left(c, 8))
Next
Range("H8:BC8").NumberFormat = "dd-mm-yyyy"
End Sub