+ Reply to Thread
Results 1 to 2 of 2

VBA DateValue formula now gives VB error for an empty string

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Bristol, England
    MS-Off Ver
    2003, 2007, 2010 & 2013
    Posts
    20

    VBA DateValue formula now gives VB error for an empty string

    Hi everyone. Has anyone else noticed a change recently, in how DateValue behaves in VBA? I am fairly sure that a few months ago, I tested something like this below in a tool I was developing, and it always worked OK when the string variable stCellVal was empty:

    ActiveCell.Value = DateValue(stCellVal)

    Even running a query in the immediate window as below, now gives error 13, the same as the above does:

    ?DateValue("")

    The same thing happens in both Excel 2010 and 2013.

    Has this changed in Excel in the last few weeks or so - and it didn't used to result in a VB error at all - or is my memory dodgy, and it was always like this?



    Many thanks,
    Nelson

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: VBA DateValue formula now gives VB error for an empty string

    I think it has always been like that. Sure you didn't have On Error Resume Next or to go to an error handler?
    Cheers
    Andy
    www.andypope.info

+ 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. Replies: 5
    Last Post: 10-16-2015, 09:18 AM
  2. [SOLVED] DateValue Function Error
    By AHV51 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-27-2015, 03:28 PM
  3. [SOLVED] Converting String to Date with DateValue, then testing for T/F
    By JoshExcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-10-2014, 10:08 PM
  4. Replies: 7
    Last Post: 08-31-2013, 09:18 PM
  5. Trying to use DateValue to extract date from string
    By mindtheGaspar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-28-2013, 07:01 PM
  6. Datevalue #Value error?
    By a94andwi in forum Excel General
    Replies: 4
    Last Post: 03-20-2007, 08:37 AM
  7. DATEVALUE & Empty cells
    By mla75 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2006, 12:25 PM

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