Sub demo()
On Error Resume Next
arr = Range("a2:a1009")
n = UBound(arr)
Dim brr(2 To 1009)
a = 2
For i = 1 To n - 1
If InStr(arr(i, 1), "发票号") > 0 Then
str1 = Replace(Replace(Split(Split(arr(i, 1), "发票号")(1), ",")(0), ")", ""), ":", "")
If str1 <> "" Then
brr(a) = brr(a) & "发票号:" & str1
Else
brr(a) = ""
End If
ElseIf InStr(arr(i, 1), "专票号") Then
str1 = Replace(Replace(Split(Split(arr(i, 1), "专票号")(1), ",")(0), ")", ""), ":", "")
If str1 <> "" Then
brr(a) = brr(a) & "专票号:" & str1
Else
brr(a) = ""
End If
ElseIf InStr(arr(i, 1), "税号") Then
str1 = Replace(Replace(Split(Split(arr(i, 1), "税号")(1), ",")(0), ")", ""), ":", "")
If str1 <> "" Then
brr(a) = brr(a) & "税号:" & str1
Else
brr(a) = ""
End If
End If
a = a + 1
str1 = ""
Next
For i = 2 To 1009
Cells(i, 3) = brr(i)
Next
End Sub
|