|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 数据整理()
Application.ScreenUpdating = False
Dim ar As Variant
With Sheets("源数据")
r = .Cells(Rows.Count, 1).End(xlUp).Row
If r < 3 Then MsgBox "源数据为空!": End
ar = .Range("a4:a" & r)
End With
Dim br()
ReDim br(1 To UBound(ar) * 50, 1 To 5)
For i = 1 To UBound(ar) Step 1
If InStr(ar(i, 1), "User Name:") > 0 Then
rr = Split(Split(ar(i + 4, 1), ":")(1), "|")
For s = 0 To UBound(rr)
If Trim(rr(s)) <> "" Then
n = n + 1
If InStr(ar(i + 6, 1), "... More") > 0 Then
br(n, 1) = ar(i + 7, 1)
Else
br(n, 1) = ar(i + 6, 1)
End If
br(n, 2) = ar(i + 1, 1)
br(n, 3) = Split(ar(i + 2, 1), ":")(1)
br(n, 4) = rr(s)
End If
Next s
End If
Next i
With Sheets("中转")
.[a1].CurrentRegion.Offset(1) = Empty
.[a2].Resize(n, 5) = br
End With
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub
|
|