Hi all,

Thanks in advance for helping. Hope the subject line above is clear enough.

This line of code error out in the code:

Cells(r,"D") = Join(NewText, "/")

Run-time error '5':
Invalid procedure call or argument


Sub test()

Dim NewText() As Variant

OldText = Range("C4:C8")
r = 4
  For Each c In OldText
        cnt = 0
    For i = 1 To Len(c)
        
        If Asc(Mid(c, i, 1)) > 48 And Asc(Mid(c, i, 1)) <= 57 Then
            cnt = cnt + 1
            ReDim Preserve NewText(1 To 1, 1 To cnt)
            NewText(1, cnt) = Mid(c, i, 1)
        End If
  Next
    
     Cells(r, "D") = Join(NewText, "/")
    r = r + 1
Next

End Sub