|
- Sub qs()
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet1.Range("a1").CurrentRegion.Value
- For i = 2 To UBound(arr)
- s = arr(i, 6): ky = arr(i, 2)
- If s = "是" Then
- dic(ky) = Array(arr(i, 1), arr(i, 2), arr(i, 3), arr(i, 4), arr(i, 5))
- End If
- Next i
- arr = Sheet3.Range("a1").CurrentRegion.Value
- ReDim brr(1 To UBound(arr), 1 To 9)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If dic.exists(s) Then
- m = m + 1
- iii = dic(s)
- For j = 0 To UBound(iii)
- brr(m, j + 1) = iii(j)
- Next
- For j = 2 To 5
- brr(m, j + 4) = arr(i, j)
- Next
- End If
- Next
- Sheet2.Range("a2").Resize(1000, 9) = ""
- Sheet2.Range("a2").Resize(m, 9) = brr
- Set dic = Nothing
- End Sub
复制代码 |
|