+ Reply to Thread
Results 1 to 3 of 3

Prevent cell comment showing Time as Decimal i.e. 12:00 as 0.5

  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    53

    Prevent cell comment showing Time as Decimal i.e. 12:00 as 0.5

    Hello,
    I am using the following code that keeps a recored of all cell entries required for my workbook. A cell audit trail if you like.
    But if the cell value is a time e.g. 12:00, when its put into the comment it shows as a decimal e.g. 0.5.
    Can anyone see what I can change to stop this.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Prevent cell comment showing Time as Decimal i.e. 12:00 as 0.5

    Your problem seems to be the way Excel treats time. Excel 'Date' is a separate 'type'. Excel 'dates and times' are also type 'Date'. With 'time only' even though in Excel you can declare a type 'Time', it is really internally stored as type 'Double' (fractional value between 0 and 1). That's why 12:00 is displayed as 0.5.

    A side effect to the following is that 'actual types of double' that are between the values of 0 and 1 may lose precision in your comment and will be displayed with the number of decimals you see when looking at the cell. For example the number 0.12345678 with number format showing two decimals, will appear in the cell as '0.12' and '0.12' will appear in your comment.

    In your Macro try the following (tested in Excel 2003):
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-12-2009
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Prevent cell comment showing Time as Decimal i.e. 12:00 as 0.5

    Hey LJMetzger, Thanks for the reply, only just got round to checking for responses.
    Your idea works perfectly, which made me think, why dont I just change the following line:
    Please Login or Register  to view this content.
    Has the same effect! Cant believe I couldnt see it? This way, it shouldnt matter what is entered into the cell, cos it will just copy it exactly.

    Thanks, wouldnt of seen it without your input.

+ 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. graph showing 1 decimal then 0 decimal
    By Sam Capricci in forum Excel Charting & Pivots
    Replies: 20
    Last Post: 05-03-2013, 11:41 AM
  2. Comment boxis not showing to near the related cell
    By krishnakuma6 in forum Excel General
    Replies: 2
    Last Post: 12-10-2012, 03:02 AM
  3. [SOLVED] Showing time as decimal
    By Thompsonchris in forum Excel General
    Replies: 5
    Last Post: 08-29-2012, 01:30 PM
  4. showing as a decimal :Time Calculations
    By jason_1 in forum Excel General
    Replies: 4
    Last Post: 08-11-2009, 10:39 PM
  5. Replies: 2
    Last Post: 11-09-2005, 02:45 PM

Tags for this Thread

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