0
I have a database in excel where in the row/column I have dates and words. Inclusive, with dates before 1900. And in some instances, only the four-digit year.
Example:
"A1" 20-07-1882 Daniel
or
"A2" 1882 João
I use, to separate the numbers from the words, this function:
Public Function SplitText(pWorkRng As Range, pIsNumber As Boolean) As String
Dim xLen As Long
Dim xStr As String
xLen = VBA.Len(pWorkRng.Value)
For i = 1 To xLen
xStr = VBA.Mid(pWorkRng.Value, i, 1)
If ((VBA.IsNumeric(xStr) And pIsNumber) Or (Not (VBA.IsNumeric(xStr)) And _
Not (pIsNumber))) Then
SplitText = SplitText + xStr
End If
Next
End Function
It works perfectly using the "TRUE" parameter. However, in the case of the date in summary form, dd-mm-yyyy it removes the trace that separates the date ("-") so the result:
20071882
The idea here is that the trace is not removed at the time of separation.