Home |
Search |
Today's Posts |
#1
|
|||
|
|||
macro to change text to time
I have a large spreadsheet of information extracted as text. The time
columns are entered as military time, but do not have the colons, 735, 1257. Would anyone know a macro that can be run down the columns to change the number to time, 07:35 AM, 12:57 PM? Thanks, |
#2
|
|||
|
|||
A regular formula would be...
=VALUE(LEFT(A1,LEN(A1)-2)&":"&RIGHT(A1,2)) A macro for a selected range of text would be... Sub Macro1() Dim rngCell As Range For Each rngCell In Selection rngCell.Value = _ Left(rngCell.Value, Len(rngCell.Value) - 2) _ & ":" & Right(rngCell.Value, 2) Next rngCell End Sub HTH, -- Gary Brown If this post was helpful, please click the ''''''''Yes'''''''' button next to ''''''''''''''''Was this Post Helpfull to you?". "JRV" wrote: I have a large spreadsheet of information extracted as text. The time columns are entered as military time, but do not have the colons, 735, 1257. Would anyone know a macro that can be run down the columns to change the number to time, 07:35 AM, 12:57 PM? Thanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change caption on a macro button | Excel Worksheet Functions | |||
How to change macro so it performs actions on ACTIVE sheet? | Excel Discussion (Misc queries) | |||
how do i change the expense statement template macro | Excel Worksheet Functions | |||
Time Stamp without change | Excel Discussion (Misc queries) | |||
Time Stamp-With Change | Excel Discussion (Misc queries) |