|
试试:
- Sub 对比()
- Set d = CreateObject("Scripting.Dictionary")
- For j = 0 To 5
- Set Rng = Range(Cells(15, 9 * j + 1), Cells(24, 9 * j + 8))
- For Each rg In Rng
- If rg <> "" Then d(rg.Text) = ""
- Next
- m = 1
- n = 1
- Set Rng = Range(Cells(4, 9 * j + 1), Cells(13, 9 * j + 8))
- For Each rg In Rng
- If rg = "" Then Exit For
- If d.exists(rg.Text) Then
- x = Int((m - 1) / 8)
- Cells(x + 27, 9 * j + m - 8 * x) = rg
- m = m + 1
- Else
- y = Int((n - 1) / 8)
- Cells(y + 34, 9 * j + n - 8 * y) = rg
- n = n + 1
- End If
- Next
- d.RemoveAll
- Next
- Set d = Nothing
- Set Rng = Nothing
- MsgBox "对比完毕!"
- End Sub
复制代码 |
|