Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JRV
 
Posts: n/a
Default 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   Report Post  
Gary L Brown
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change caption on a macro button gbeard Excel Worksheet Functions 3 April 21st 05 01:43 PM
How to change macro so it performs actions on ACTIVE sheet? Tom9283 Excel Discussion (Misc queries) 6 April 15th 05 07:32 AM
how do i change the expense statement template macro Mad2691 Excel Worksheet Functions 1 January 28th 05 01:21 PM
Time Stamp without change AntonyY Excel Discussion (Misc queries) 3 November 26th 04 09:13 AM
Time Stamp-With Change AntonyY Excel Discussion (Misc queries) 1 November 25th 04 11:38 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"