|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- .Range("a27:ba32,a34:ba43").ClearContents
- For j = 1 To 46 Step 9
- d.RemoveAll
- For i = 4 To 15 Step 11
- arr = .Cells(i, j).Resize(10, 8)
- For x = 1 To UBound(arr)
- For y = 1 To UBound(arr, 2)
- If Len(arr(x, y)) <> 0 Then
- If Not d.exists(arr(x, y)) Then
- Set d(arr(x, y)) = CreateObject("scripting.dictionary")
- End If
- d(arr(x, y))(i) = ""
- End If
- Next
- Next
- Next
- ReDim crr(1 To 6, 1 To 8)
- ReDim drr(1 To 10, 1 To 8)
- m1 = 1
- n1 = 1
- m2 = 1
- n2 = 1
- tt = d.items
- For Each aa In d.keys
- If d(aa).Count > 1 Then
- crr(m1, n1) = aa
- n1 = n1 + 1
- If n1 > 8 Then
- n1 = 1
- m1 = m1 + 1
- End If
- Else
- drr(m2, n2) = aa
- n2 = n2 + 1
- If n2 > 8 Then
- n2 = 1
- m2 = m2 + 1
- End If
- End If
- Next
- .Cells(27, j).Resize(UBound(crr), UBound(crr, 2)) = crr
- .Cells(34, j).Resize(UBound(drr), UBound(drr, 2)) = drr
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|