Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 26
Default Macro to change time format....

Hi, please see attached....

I need a macro to put the times into 'hh:mm' format. At the minute some are 'h:mm' and they are all in text format.

Is there a way to run a macro on the times to change all to 'hh:mm'?

Thanks
Neil
Attached Files
File Type: zip Whereabouts2.zip (20.4 KB, 669 views)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Macro to change time format....

Neil,

Select all the cells that need to be changed and run the macro below.

HTH,
Bernie
MS Excel MVP

Sub ChangeTimeStringsToTimes()
Dim myC As Range
For Each myC In Selection
myC.Value = TimeValue(myC.Value)
myC.NumberFormat = "hh:mm"
Next myC
End Sub


"neilcarden" wrote in message
...

Hi, please see attached....

I need a macro to put the times into 'hh:mm' format. At the minute some
are 'h:mm' and they are all in text format.

Is there a way to run a macro on the times to change all to 'hh:mm'?

Thanks
Neil


+-------------------------------------------------------------------+
|Filename: Whereabouts2.zip |
|Download: http://www.excelbanter.com/attachment.php?attachmentid=104|
+-------------------------------------------------------------------+



--
neilcarden



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
Can we change the format for pre set footers like date, time etc. Pavan Excel Discussion (Misc queries) 0 November 7th 07 05:50 AM
change text format to time Hans Excel Worksheet Functions 3 October 18th 07 01:26 PM
Change time format from :0 to 0:0 Donald B[_2_] Excel Worksheet Functions 4 July 6th 07 03:53 AM
macro to change text to time JRV Excel Worksheet Functions 1 June 29th 05 09:36 PM
change format for time value Qaspec Excel Discussion (Misc queries) 1 May 23rd 05 10:25 PM


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