Results 1 to 5 of 5

Date notation not recognized by vba

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Date notation not recognized by vba

    Hi,

    I have dates in a string in excel which are formatted like "dd.mm.yyyy"
    I don't manage to get VBA to recognize the date, I get the error 13 "Type mismatch" on the line ConvertToDate = CDate(x(1))

    Example: in the following code x(1) = 06.07.2020
    Sub Test
    Dim x() As String, ConvertToDate As Date, foundRng As Range, lastRow As Long
    With Sheets("Convert")
    lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    Set foundRng = .Range(.Cells(1, 1), .Cells(lastRow, 1)).Find("Date")
    x = Split(foundRng.Offset(1), " / ")
    ConvertToDate = CDate(x(1))
    End With
    End Sub
    I assume I try to make the string look like a date in the wrong way?

    Your help would be appreciated!
    Last edited by Solvax; 11-07-2020 at 06:20 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] date & time not recognized in cells; need a formula.
    By countryfan_nt in forum Excel General
    Replies: 2
    Last Post: 08-23-2016, 09:42 AM
  2. date time stamp not recognized
    By hiswillbedun in forum Excel General
    Replies: 1
    Last Post: 11-19-2015, 05:41 PM
  3. Date not recognized
    By juan.doe in forum Excel General
    Replies: 5
    Last Post: 01-12-2015, 02:41 AM
  4. [SOLVED] Date not being recognized
    By warpdesign in forum Excel General
    Replies: 5
    Last Post: 12-09-2014, 02:14 PM
  5. Date format (xx/xx/xxxx) not recognized?
    By Sybil in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-14-2013, 01:34 PM
  6. [SOLVED] Date format not recognized
    By matt3m in forum Excel General
    Replies: 4
    Last Post: 09-06-2012, 07:59 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