+ Reply to Thread
Results 1 to 5 of 5

Converting General format in to HH:MM format

  1. #1
    Registered User
    Join Date
    09-27-2007
    Posts
    10

    Converting General format in to HH:MM format

    Hi

    I am trying to alter a column which is formatted in "General" I.e Just Numbers (1, 2, 1.5 etc)

    I am trying to get the values to read as HH:MM format so 1.5 becomes 01:30, 2 becomes 02:00 etc.

    The code I have used in the past is as follows:

    Please Login or Register  to view this content.
    For some reason on this occassion it is coming up with an error on the line Cell.Value = Cell.Value / 24 and I really can't see why.

    I have used this piece of code countless times before with no problems but on this occassion it simply won't work.

    Has anybody got any ideas?

    Thanks In Advance
    Mark

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Think it's because of this line

    Please Login or Register  to view this content.
    If it's not formatted as General you will get a error

    VBA Nobo
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    09-27-2007
    Posts
    10
    The thing is it is formatted as general (well, when I right click on it and go in to Format Cells it shows as General under the Number Tab).

    Any ideas? I really can't see where it is going wrong.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Registered User
    Join Date
    09-27-2007
    Posts
    10
    That seems to work fine.

    So was the problem caused by the fact that the first cell (i.e the heading) wasn't numeric? Something so simple??

    How annoying!

    Thanks (again!) for your help, really appreciate it.

    I'm going home to have a cry now!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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