|
Sub test()
Dim i As Integer
Dim j As Integer
Dim arr
Dim str, str1
arr = Range("a1", Range("a65536").End(xlUp))
For i = 2 To UBound(arr)
str = ""
str1 = arr(i, 1)
For j = 1 To Len(arr(i, 1))
If VBA.IsNumeric(Mid(arr(i, 1), j, 1)) Then
n = j
m = --Mid(arr(i, 1), j, 1)
If n = Len(arr(i, 1)) Then
str = VBA.Replace(str1, str1, str1 & ";")
Cells(i, 2) = str
Exit For
End If
If ";" = Mid(str1, Len(str1), 1) Then
Cells(i, 2) = str1
Exit For
End If
Do
j = j + 1
Loop Until Not VBA.IsNumeric(Mid(arr(i, 1), j, 1))
y = y + 1
str = str & Application.WorksheetFunction.Replace(str1, j - 2 + y, 1, Mid(arr(i, 1), j - 1, 1) & ";")
str1 = str
str = ""
End If
Next
Next
End Sub
|
|