Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
BT Bill
 
Posts: n/a
Default Convert hhhh:mm:ss to hh:mm:ss (macro ?)


British Telecom use hhhh:mm:ss as a time format for length of call in
downloaded accounts. Excel97 does not recognise this as a number so I cannot
reformat to hh:mm:ss. I've tried (with no experience) a macro to remove the 2
leading zeros, but if I set it up by converting the first 10 times, then try
to run it starting at the 11th time, it does not convert the second set of
ten, but simply replicates the times created (for the first ten) when setting
up the macro.

BT Bill
  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 7 Mar 2005 23:53:01 -0800, "BT Bill"
wrote:


British Telecom use hhhh:mm:ss as a time format for length of call in
downloaded accounts. Excel97 does not recognise this as a number so I cannot
reformat to hh:mm:ss. I've tried (with no experience) a macro to remove the 2
leading zeros, but if I set it up by converting the first 10 times, then try
to run it starting at the 11th time, it does not convert the second set of
ten, but simply replicates the times created (for the first ten) when setting
up the macro.

BT Bill


No need for a macro. You can use the formula:

=--MID(A1,3,8)

to do the conversion.

You may also use the Data/Text to Columns wizard to do a conversion in place if
the range is in a column.

1. Select the range.
2. Date/Text to Columns
3. Fixed Width
Next
4. Drop a break line just after the 00
Next
5. The first column (00) will be selected. Check the "Do not import column"
box.
6. Finish

The above could be recorded as a macro.

Finally, to do this as a macro, after selecting the range of values to convert:

========================
Sub foo()
Dim c As Range

For Each c In Selection
c.Value = Mid(c.Text, 3, 8)
Next c

End Sub
==========================


--ron
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
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
automatic macro update boconnell Excel Worksheet Functions 4 February 9th 05 07:10 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro Formula revision? Mark Excel Worksheet Functions 1 November 28th 04 01:43 AM


All times are GMT +1. The time now is 07:40 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"