I have an Excel worksheet which includes a text column which stores both text and numbers. I am trying to extract serial numbers, which are 13 digits long, and replace the column content with these serial numbers. I was able to extract the serial numbers but I am stalling on how to replace the cell.value with the serial numbers. Below is my initial approach:
Sub extract_digits()
Dim cell As Range
Dim arr As Variant, arrElem As Variant
Dim final_arr As Variant
With Worksheets("Test_1")
For Each cell In .Range("H5", .Cells(.Rows.Count, "H").End(xlUp))
arr = Split(Replace(cell.Value, " ", " "), " ")
For Each arrElem In arr
If Len(arrElem) = 13 Then MsgBox arrElem
Next arrElem
Next cell
End With
End Sub
cell.value=arrElem