+ Reply to Thread
Results 1 to 2 of 2

time error

  1. #1
    SMH
    Guest

    time error

    I have an application in EXCEL using macros. The program has to read an empty
    cell which should give a value 12:00:00 AM for all blank empty cells. On one
    machine it works but on a another PC this does not work.

    The cell when read (using the same spreadsheet) reads 00:00:00 rather than
    12:00:00 AM or PM in the second machine. I have tried all sorts of formats
    and even entered 12:00:00 PM in the cell but the value read is always
    00:00:00 and so themacro does not work on the second machin.First machine is
    running window xp professional and the second machine (where the problem is )
    is running windows home. Both machines are running the same version of excel.

    What is the cell format that I should enter in the second machine so the the
    cells will read 12:00:00 rather than 00:00:00

    thanks in advance

  2. #2
    Ron Rosenfeld
    Guest

    Re: time error

    On Sun, 26 Jun 2005 07:53:02 -0700, SMH <[email protected]> wrote:

    >I have an application in EXCEL using macros. The program has to read an empty
    >cell which should give a value 12:00:00 AM for all blank empty cells. On one
    >machine it works but on a another PC this does not work.
    >
    >The cell when read (using the same spreadsheet) reads 00:00:00 rather than
    >12:00:00 AM or PM in the second machine. I have tried all sorts of formats
    >and even entered 12:00:00 PM in the cell but the value read is always
    >00:00:00 and so themacro does not work on the second machin.First machine is
    >running window xp professional and the second machine (where the problem is )
    >is running windows home. Both machines are running the same version of excel.
    >
    >What is the cell format that I should enter in the second machine so the the
    >cells will read 12:00:00 rather than 00:00:00
    >


    h:mm:ss AM/PM

    However, the cell format is NOT your problem.

    The cell format only controls what is DISPLAYED in the cell. It has no effect
    over what is STORED in that cell. The Value (or contents) (cell.value) of a
    cell that displays the time 12:00:00 AM is zero (0), and the Value of a cell
    that displays the time 12:00:00 PM will be 0.5.

    Perhaps a more robust fix for your macro would be to look at the .value
    property rather than the .text property of the cells you are checking.

    Here are some examples:

    ?[a1].text
    12:00:00 AM
    ?[a1].value
    0
    ?[a2].text
    12:00 PM
    ?[a2].value
    0.5


    --ron

+ 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