+ Reply to Thread
Results 1 to 3 of 3

Date interpreted as text - how to force as number?

  1. #1
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Date interpreted as text - how to force as number?

    Hi

    I have a cell, say $B$5, which contains a date, entered as a date and formatted as a date (dd/mm/yyyy).
    By way of example I enter the string 23/03/2010 and it appears as 23/03/2010. Furthermore, if I undertake mathematical operations on this value it is treated, predictably and correctly, as having a numerical value 40260.
    So far, so good.

    Now, as part of a VBA macro there is the statement

    Please Login or Register  to view this content.
    Cell $C$10 is also formatted as a date, and on completion of the code, it displays the expected value 23/03/2010. Again, for mathematical operations treat this as having value 40260. EXCEPT IN ONE RESPECT: If I enter in another cell the formula
    =ISNUMBER($C$10) it returns FALSE despite that =ISNUMBER($B$5) returns TRUE.

    If I place the cursor on cell $C$10 and press <F2> to go into edit mode, followed by <Enter>, without making any changes, then subsequent query =ISNUMBER($C$10) returns TRUE.

    What line of code can I enter after (or instead of) the above so that the query ISNUMBER($C$10) returns TRUE without requiring the user to edit the cell making no changes?

    Thanks

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,991

    Re: Date interpreted as text - how to force as number?

    I assume that's not your actual code, since it wouldn't work...

    Try using:
    Please Login or Register  to view this content.
    though I can't recall ever seeing what you describe before.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Re: Date interpreted as text - how to force as number?

    You are quite right I was being very stupid

+ 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