|
- Sub test()
- Dim r%, i%
- Dim arr, brr(), crr(), drr()
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 6).End(xlUp).Row
- arr = .Range("f2:g" & r)
- ReDim brr(1 To UBound(arr), 1 To 2)
- For i = 1 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If Len(arr(i, j)) <> 0 Then
- ReDim crr(0 To 9)
- For k = 1 To Len(arr(i, j))
- n = Val(Mid(arr(i, j), k, 1))
- crr(n) = 1
- Next
- brr(i, j) = crr
- End If
- Next
- Next
- ReDim drr(1 To UBound(arr), 1 To 5)
- For i = 6 To UBound(arr)
- For j = 1 To 5
- For k = 0 To 9
- If brr(i, 2)(k) = brr(i - (6 - j), 1)(k) And brr(i, 2)(k) = 1 Then
- drr(i, j) = "第" & j & "个单元格有重复数字"
- Exit For
- End If
- Next
- Next
- Next
- .Range("p2").Resize(UBound(drr), UBound(drr, 2)) = drr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|