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!
Bookmarks