+ Reply to Thread
Results 1 to 8 of 8

Splitting Date & Time Into 24 Hour Time

  1. #1
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249

    Splitting Date & Time Into 24 Hour Time

    I have a spreadsheet that I need to split the date and time out to seperate columns.

    The format is as such: 28/04/2008 15:03:05 in column AN

    When I run a text to columns splitting on spaces through my macro it displays the time as 03:03:05 in Column AO and PM in Column AO.


    Please Login or Register  to view this content.
    Can anyone correct this as I need to copy the date from AN and also the Time from AO. The time needs to be in 24 hour format in order for my comparison to work properly.

    Thanks in advance!
    Last edited by VBA Noob; 06-04-2008 at 03:54 PM.
    McCrimmon

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Try adjusting your Array information.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249
    Thanks for getting back to me!
    Still doesnt work unfortunately!

    It seems to work if I was to do it within the workbook itself as a record macro function.

    However, as soon as I add the code into the existing vba code it spits out this result rather than the 24 hour time.

    Anyone able to add further help?

  4. #4
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249
    Anyone?

    Thanks

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Seeing as the code posted so far works you will have to supply more information regarding the exsiting code where it does not work.

  6. #6
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249
    Andy,

    Thanks for getting back to me again.

    See attached:

    Run macro and you will see what it is doing.

    Thanks

    Brian
    Attached Files Attached Files

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Thanks,

    I can see the problem but not a solution using the current code.
    It must format the date into dd/mm/yyyy hh:mm:ss AM/PM before spliting on spaces.

    How about splitting on widths?

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249
    Thanks Andy.

    I think I will use that solution for the time being.

    If you have any other thoughts or solutions, please give me a shout!

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Time Difference in hours between two date time stamps
    By Cipher in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2010, 10:24 AM
  2. Label to display current Date, Time
    By robbert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2008, 04:18 PM
  3. Hours difference between 2 Date & Time stamps
    By bondi26 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-21-2007, 10:24 PM
  4. Time & Date
    By tomicT in forum Excel General
    Replies: 3
    Last Post: 04-16-2007, 05:00 PM
  5. Adding Column dependent on Date Time
    By Chaz1945 in forum Excel General
    Replies: 4
    Last Post: 03-02-2007, 06:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1