Sub tt()
On Error Resume Next
Dim arr(1 To 10000, 1 To 1)
n = 1
For i = 2 To Sheet1.[a65536].End(3).Row
If Left(Sheet1.Cells(i, 1), 4) = "收件地址" Then
arr(n, 1) = Sheet1.Cells(i, 1)
n = n + 1
Else
arr(n - 1, 1) = arr(n - 1, 1) & Sheet1.Cells(i, 1)
End If
Next
Sheet2.Range("a2").Resize(n) = arr
For j = 1 To n
x = InStr(arr(j, 1), "收件地址")
y = InStr(arr(j, 1), "收件人")
Z = InStr(arr(j, 1), "联系电话")
Sheet2.Cells(j + 1, 2) = Mid(arr(j, 1), x + 5, y - x - 5)
Sheet2.Cells(j + 1, 4).NumberFormatLocal = "@"
Sheet2.Cells(j + 1, 4) = Mid(arr(j, 1), Z + 5)
Sheet2.Cells(j + 1, 3) = Mid(arr(j, 1), y + 4, Z - y - 4)
Next
End Sub |