|
筛选- Sub lqxs()
- Dim Arr, i&, x$, y, kk, tt, aa, j%, sl, hs$
- Dim d, k, t
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Sheet2.Activate
- [a2:r5000].ClearContents
- Arr = Sheet1.[a1].CurrentRegion
- For i = 2 To UBound(Arr)
- y = Arr(i, 1)
- If Arr(i, 14) <> "" Then x = Arr(i, 14)
-
- If d.exists(x) = False Then Set d(x) = CreateObject("Scripting.Dictionary")
- d(x)(y) = d(x)(y) & i & ","
- Next
- k = d.keys: t = d.items
- For i = 0 To UBound(k)
- kk = t(i).keys: tt = t(i).items
- For ii = 0 To UBound(kk)
- tt(ii) = Left(tt(ii), Len(tt(ii)) - 1)
- sl = 0
- If InStr(tt(ii), ",") Then
- aa = Split(tt(ii), ",")
- For j = 0 To UBound(aa)
- sl = sl + Arr(aa(j), 4)
- Next
- Else
- sl = Arr(tt(ii), 4)
- End If
- If sl <= 4 Then
- hs = hs & tt(ii) & ","
- End If
- Next
- Next
- hs = Left(hs, Len(hs) - 1)
- aa = Split(hs, ",")
- For j = 0 To UBound(aa)
- Cells(j + 2, 1).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, aa(j), 0)
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码
的代码: |
评分
-
1
查看全部评分
-
|