or all togeather
Option Explicit
Sub ptest()
Dim RegEx As Object, b(), i, z, e
Dim Myrange As Range, C As Range
ReDim b(1 To 12, 1 To 1)
Set RegEx = CreateObject("vbscript.regexp")
Set Myrange = ActiveSheet.Range("A2:A12")
With RegEx
.MultiLine = False
.Global = True
.IgnoreCase = True
.Pattern = "([0-9]+)"
For Each C In Myrange
i = i + 1
b(i, 1) = RegEx.Replace(C, "," & "$1" & ",")
Next
End With
For i = 1 To 12
z = 2
For Each e In Split(b(i, 1), ",")
e = Trim(e)
Debug.Print e
If Not IsEmpty(e) Then
Cells(i + 1, z) = e
z = 1 + z
End If
Next
Next
Set Myrange = Nothing
Set RegEx = Nothing
End Sub
Bookmarks