+ Reply to Thread
Results 1 to 3 of 3

DateValue fail to get serial number

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    taipei,taiwan
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question DateValue fail to get serial number

    The code are as follows,why day_ser1 is "2014/1/22"
    Please Login or Register  to view this content.
    pls help, thanks!
    Last edited by jeffcde; 01-28-2014 at 04:08 AM.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: DateValue fail to get serial number

    When you declare variables as
    Please Login or Register  to view this content.
    VBA does not act as you might expect. The variables are not both Longs. Day_ser1 has not been defined with a type so it is created with the default type of Variant.

    VBA is then assuming (correctly) the variant is a date and giving the unexpected result.

    You should explicitly define every variable as a particular type
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    taipei,taiwan
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: DateValue fail to get serial number

    much thanks!

+ 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. [SOLVED] Need a formula for pass/fail based on no. of Y answers but automatically fail if 3a is N
    By Researcher1111 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-15-2013, 10:20 PM
  2. [SOLVED] Help wih serial number
    By vpnvipin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-29-2012, 06:17 AM
  3. Overwrite the advanced filtered data serial number column with unique number
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-15-2012, 12:38 AM
  4. modify serial number if number already exists
    By surfengine in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2010, 07:49 PM
  5. Finding a serial number in a list of serial numbers
    By zocoloco in forum Excel General
    Replies: 2
    Last Post: 02-04-2009, 05:20 AM

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