|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
简单修改几下就好了。
Sub t()
Dim arr, d, sh As Worksheet, i, j As Integer
Set d = CreateObject("Scripting.Dictionary")
Sheet5.[b3:f8] = ""
For j = 1 To 5
For Each sh In Sheets
If sh.Name <> "统计" Then
arr = sh.Range("a2").CurrentRegion
For i = 3 To 6
If arr(i, 5) = Sheet5.Cells(2, j + 1) Then
d(arr(i, 3)) = ""
End If
Next
End If
Next
[Sheet5].[a3].Offset(0, j).Resize(d.Count) = Application.Transpose(d.keys)
d.RemoveAll
Next
Set d = Nothing
End Sub |
|