Source: www.belltechsystems.com
Question:
Downloads have the system date is 2012-mm-dd hh: mm: ss General format. I need to convert to the format of date normal mm-dd-yy hh: mm: ss.
Thank you
Answer:
Select your cells and run this small macro:
Sub ReFormat()
Dim r As Range, v As String
For each r in selection
v = r.Text
year = Left (v, 4)
MN = Mid (v, 6, 2)
dy = Mid (v, 9, 2)
HR = Mid (v, 12, 2)
Mint = Mid (v, 15, 2)
SC = Right (v, 2)
r.NumberFormat = "mm-dd-yy hh: mm: ss"
r.value = DateSerial (year, mn, dy) + TimeSerial (RH, mint, sc)
Next
End Sub
Macros are very easy to install and use:
1 ALT - F11 brings the VBE window
2 ALT - I
ALT - M opens a new module
3 paste these things in and close the VBE window
If you save the workbook, the macro will be saved with it.
To delete the macro:
1. open the VBE window as above
2 erase the code
3 Close the VBE window
To use the Excel macro:
1 ALT - F8
2. Select the macro
3 Key RUN
For more information about macros in General, see:
http://www.MVPs.org/dmcritchie/Excel/getstarted.htm
0 Comments