|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- 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)
- brr(m, n) = arr(k, n)
- Next n
- End If
- Next k
- End If
- Next sh
- Sheets("汇总").Range("a2:g1000").ClearContents
- Sheets("汇总").Range("a2").Resize(m, 7) = brr
- End Sub
复制代码 |
|