|
按6楼代码,楼主给出的结构修改:
Sub shaixuan()
Dim sh As Worksheet, arr, brr(1 To 1000, 1 To 8), k, m, n, dstr
dstr = Sheets("汇总").Range("j2").Value
For Each sh In Worksheets
If sh.Name <> "汇总" Then
arr = sh.Range("a1").CurrentRegion
For k = 2 To UBound(arr)
If arr(k, 2) = dstr Then
m = m + 1
For n = 1 To UBound(arr, 2) - 2
brr(m, n) = arr(k, n)
Next n
brr(m, UBound(arr, 2) - 1) = arr(k, UBound(arr, 2))
End If
Next k
End If
Next sh
Sheets("汇总").Range("a2:g1000").ClearContents
Sheets("汇总").Range("a2").Resize(m, 7) = brr
End Sub |
|