|
- Sub 按钮1_单击()
- Dim Arr, i&, sz, gs, j&, aa
- Dim d, k, t
- Set d = CreateObject("Scripting.Dictionary")
- Sheet1.Activate
- [g:g].ClearContents
- sz = [c1].Value: gs = [d1].Value
- Arr = [b1].CurrentRegion
- For i = 1 To UBound(Arr) - gs
- If Arr(i, 1) = sz Then d(Arr(i, 1)) = d(Arr(i, 1)) & i & ","
- Next
- k = d.keys: t = d.items: n = 1
- For i = 0 To UBound(k)
- t(i) = Left(t(i), Len(t(i)) - 1)
- If InStr(t(i), ",") Then
- aa = Split(t(i), ",")
- For j = 0 To UBound(aa)
- Cells(n, 7).Resize(gs, 1) = Cells(aa(j) + 1, 2).Resize(gs, 1).Value
- n = n + gs
- Next
- Else
- [g1].Resize(gs, 1) = Cells(t(i) + 2, 2).Resize(gs, 1).Value
- End If
- Next
- End Sub
- Sub lqxs()
- Dim Arr, i&, sz, gs, n&
- Sheet2.Activate
- [g:g].ClearContents
- sz = [c1].Value: gs = [d1].Value: n = 1
- Arr = [b1].CurrentRegion
- For i = 1 To UBound(Arr) - gs
- If InStr(Arr(i, 1), sz) Then
- Cells(n, 7).Resize(gs, 1) = Cells(i + 1, 2).Resize(gs, 1).Value
- n = Cells(Rows.Count, 7).End(xlUp).Row + 1
- End If
- Next
- End Sub
复制代码 |
|