+ Reply to Thread
Results 1 to 5 of 5

Automatic 24 Hour time format

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Automatic 24 Hour time format

    Hello Excellers,

    What is the VBA code to convert a cell into 24-Hour time format that I could add to the sheet's code?

    0800 becomes 08:00
    1500 becomes 15:00
    1815 becomes 18:15
    Etc...

    This is what I am looking for that is similar to the code below that converts the letters to all Uppercase:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Thanks!

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Automatic 24 Hour time format

    it would be
    Please Login or Register  to view this content.
    I guess.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatic 24 Hour time format

    Hi,

    Untested in your workbook but try


    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Automatic 24 Hour time format

    The code I posted above is an example of what I used for UpperCase.

    However, How may I direct the 24-hour format code to be applied to only a specific cell or two?

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Automatic 24 Hour time format

    You asked for something akin to your upper case conversion. That was focused on the Target cell in the sheet change event and you appeared to be suggesting that the time format was also to be applied to target cell which is why I gave you what I did.

    Just substitute the Cell Reference for the word Target. i.e.

    Please Login or Register  to view this content.

+ 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. Replies: 3
    Last Post: 11-24-2012, 05:52 AM
  2. 24 hour time format help with 00:00 calculation
    By pogo in forum Excel General
    Replies: 9
    Last Post: 07-22-2006, 08:15 AM
  3. Replies: 5
    Last Post: 06-28-2006, 02:20 PM
  4. [SOLVED] Convert decimal hour into time format?
    By ramdalen in forum Excel General
    Replies: 2
    Last Post: 06-20-2005, 02:05 PM
  5. [SOLVED] Converting time figures into 24-hour format & sorting them...
    By Clint Johnson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2005, 10:06 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