|
发表于 2013-3-3 10:50
|
显示全部楼层
本楼为最佳答案
- Sub aa()
- Rows("4:4").AutoFilter
- Rows("4:4").AutoFilter Field:=5, Criteria1:="1"
- '-------------原来的BB 过程代码------------------------
- Dim arr, brr(), i%, lr&, sh As Worksheet, c As Range
- Application.ScreenUpdating = False
- arr = Array(0, 0, 5, 7, 8, 0, 9, 17)
- Set sh = ActiveSheet
- lr = sh.UsedRange.Row + sh.UsedRange.Rows.Count - 1
- ReDim brr(1 To lr, 1 To 1)
- With Workbooks.Open(ThisWorkbook.Path & "\B.xls")
- With .Sheets(1)
- For i = 2 To UBound(arr)
- If arr(i) Then
- m = 0
- For Each c In Intersect(sh.Cells(5, arr(i)).Resize(lr), sh.Columns(arr(i)).SpecialCells(12))
- m = m + 1
- brr(m, 1) = c.Value
- Next
- .Cells(4, i).Resize(m) = brr
- End If
- Next
- End With
- .Close True
- End With
- Application.ScreenUpdating = True
- '---------------BB过程代码-------------
- Rows("4:4").AutoFilter
- End Sub
复制代码 |
|