+ Reply to Thread
Results 1 to 2 of 2

Strangeness with times

  1. #1
    Registered User
    Join Date
    05-09-2005
    Location
    Cambridge UK
    Posts
    1

    Strangeness with times

    I am trying to copy a cell containing a time to another using .value but this results in a decimal!

    Try running this on your computer:

    Cells(1, 1).Value = "18:00"
    Cells(1, 2).Value = Cells(1, 1).Value

    On the first cell, the value is 18:00 all right, but the second cell is 0.75! (=18/24 perhaps?)

    Can anybody explain why this happens? Is there is a way to copy the time correctly?

    I know that a copy-and-paste will get round this, but do not want to it because it will transfer all the formatting from my source cell to my target cell.

    Many thanks,

    Andrew

  2. #2
    Registered User
    Join Date
    08-20-2003
    Location
    Luton, England
    Posts
    63
    The number is OK, all dates/times are stored as numbers. You just need to *format the cell * correctly.
    Regards
    BrianB
    Most problems are caused by starting from the wrong place.
    Use a cup of coffee to speed up all Windows processes.
    It's easy until you know how.
    -----------------------------------------

+ 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