|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
建议从基础学习 学习循环 数组 判断
以下代码仅供测试参考
- Sub update()
- Dim arr, brr(1 To 10000, 1 To 7)
- Dim ws As Worksheet
- For Each ws In Worksheets
- If ws.Name <> "信息汇总" Then
- With ws
- r = .[b65536].End(xlUp).Row
- arr = .Range("a3:ac" & r)
- For i = 1 To UBound(arr)
- If arr(i, 15) = "是" Then
- n = n + 1
- brr(n, 1) = n
- brr(n, 2) = ws.Name
- brr(n, 3) = arr(i, 2)
- brr(n, 4) = arr(i, 3)
- brr(n, 5) = arr(i, 15)
- brr(n, 6) = arr(i, 16)
- brr(n, 7) = arr(i, 17)
- End If
- Next
- End With
- End If
- Next
- With Worksheets("信息汇总")
- .UsedRange.Offset(1).ClearContents
- .[a2].Resize(n, 7) = brr
- End With
- MsgBox "OK!", vbInformation
- End Sub
复制代码 |
|