|
- Sub bajifeng() 'bajifeng
- 'http://club.excelhome.net/thread-1246855-2-1.html
- Dim brr()
- Application.EnableEvents = False
- Sheets("筛选结果").Activate
- s = [a2] & [b2] & [c2]
- b = IIf([b2] = 0, 0, 1)
- Sheets("筛选结果").UsedRange.Offset(4).Clear
- For Each Sh In Sheets
- i = 0
- If InStr(Sh.Name, "筛") = 0 Then
- If InStr(Sh.Name, "目录") = 0 Then
- Sh.Activate
- lr = Sh.[a65536].End(3).Row
- Debug.Print Sh.Name
- arr = Sh.Range([a2], Cells(lr, "g"))
- For i = 1 To UBound(arr)
- If b = 1 And InStr(arr(i, 1) & arr(i, 2) & arr(i, 4), s) > 0 Then
- n = n + 1
- ReDim Preserve brr(1 To 7, 1 To n)
- For j = 1 To 7
- brr(j, n) = arr(i, j)
- Next
- ElseIf b = 0 And InStr(arr(i, 1) & arr(i, 4), s) > 0 Then
- n = n + 1
- ReDim Preserve brr(1 To 7, 1 To n)
- For j = 1 To 7
- brr(j, n) = arr(i, j)
- Next
- End If
- Next
- End If
- End If
- Next
- Sheets("筛选结果").Activate
- [a5:g5].Resize(UBound(brr, 2)) = Application.Transpose(brr)
- Application.EnableEvents = True
- End Sub
复制代码 |
|