|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 汇总()
With Sheet1
r = .Cells(Rows.Count, 1).End(xlUp).Row
ar = .Range("a1:l" & r)
End With
ReDim br(1 To r, 1 To 5)
For i = 3 To r
If InStr(ar(i, 1), "客户名称") > 0 Then
n = n + 1
br(n, 1) = ar(i, 2)
br(n, 2) = ar(i, 9)
For s = i + 3 To r
If InStr(ar(s, 7), "人民币:") > 0 Then
br(n, 3) = ar(s, 8)
Exit For
End If
Next s
For s = i + 3 To r
If Trim(ar(s, 12)) <> "" Then
If IsDate(ar(s, 12)) Then
br(n, 4) = ar(s, 11)
br(n, 5) = ar(s, 12)
Exit For
End If
End If
Next s
End If
Next i
With Sheets("明细表")
.[a1].CurrentRegion.Offset(1) = Empty
.[a2].Resize(n, 5) = br
End With
End Sub
|
|