|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 bajifeng 于 2015-12-21 10:44 编辑
- Sub bajifeng() 'bajifeng
- Dim brr()
- s = [a2] & [b2] & [c2]
- b = IIf([b2] = 0, 0, 1)
- Sheets(1).UsedRange.Offset(4).Clear
- For Each sh In Sheets
- i = 0
- If InStr(sh.Name, "筛") = 0 Then
- sh.Activate
- lr = sh.[a65536].End(3).Row
- 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
- Next
- Sheets(1).Activate
- [a5:g5].Resize(UBound(brr, 2)) = Application.Transpose(brr)
- End Sub
复制代码 |
|