|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请测试:
Sub Macro1()
Dim arr, brr(), d As Object, ds As Object, i&, j%, temp%, lr%
arr = Range("N1:Y6")
Set d = CreateObject("scripting.dictionary")
Set ds = CreateObject("scripting.dictionary")
For j = 1 To UBound(arr, 2)
Set d(j) = CreateObject("scripting.dictionary")
Next
For i = 2 To UBound(arr)
For j = 1 To UBound(arr, 2)
d(j)(arr(i, j)) = ""
Next
Next
arr = Range("A2:L" & Range("A65536").End(xlUp).Row)
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
For j = 1 To UBound(arr, 2)
For i = 1 To UBound(arr)
arr(i, j) = Format(arr(i, j), "00")
temp = Val(Left(arr(i, j), 1)) + Val(Right(arr(i, j), 1))
If d(j).Exists(temp) Then
ds(j) = ds(j) + 1
brr(ds(j), j) = arr(i, j)
End If
Next
If ds(j) > lr Then lr = ds(j)
Next
ActiveSheet.UsedRange.Offset(6, 13).Clear
With Range("N7").Resize(lr, UBound(arr, 2))
.Value = brr
.NumberFormatLocal = "00"
End With
End Sub |
|