|
生成的字典中包含了前面两张表中的所有数字,只需要去除掉表甲1中的数字即可,因此可在
k = d.keys的前一行加上:
For Each rn3 In crr
d.Remove rn3
Next
即可。
也可改变循环方式,发现重复的就去除掉,可作如下修改:
For Each rn1 In arr
If rn1 <> "" Then
For Each rn2 In brr
If rn2 <> "" Then
If rn1 = rn2 Then
n = n + 1
m = IIf(n < 8, 1, Int(n / 8))
p = IIf(n Mod 8 = 0, 8, n Mod 8)
crr(m, p) = rn2
Set rng1 = Nothing
Set rng2 = Nothing
Else
d(rn1) = ""
d(rn2) = ""
End If
End If
Next
End If
Next
改为:
For j = 1 To 10 '改循环方式
For k = 1 To 8
If arr(j, k) <> "" Then
For x = 1 To 10 '改循环方式
For y = 1 To 8
If brr(x, y) <> "" Then
If arr(j, k) = brr(x, y) Then
n = n + 1
m = IIf(n < 8, 1, Int(n / 8))
p = IIf(n Mod 8 = 0, 8, n Mod 8)
crr(m, p) = brr(x, y)
Set rng1 = Nothing
Set rng2 = Nothing
d.Remove brr(x, y) '去重
brr(x, y) = "" '去重
Exit For
Else
d(arr(j, k)) = ""
d(brr(x, y)) = ""
End If
End If
Next
Next
End If
Next
Next
以上只是一种思路,提供参考。 |
评分
-
1
查看全部评分
-
|