|
哪位大神帮我看看,下面代码问题在哪里,当输入的号码是大于6以上的对子时显示错误,但是小于6以下的对子时有时正确的,遇到豹子666也会显示错误,上标号码不显示出来
Sub pszx()
Dim brr()
Dim crr()
Dim drr()
Dim zrr()
r = Sheet1.Cells(Rows.Count, 3).End(xlUp).Row
arr = Sheet1.Range("C4:E" & r)
ys = Sheet1.Range("F3:O3")
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
'a = arr(i, j) Mod 10
a = arr(i, j)
ReDim Preserve drr(1 To UBound(arr), 1 To 3)
drr(i, j) = a
ReDim Preserve brr(1 To UBound(arr), 1 To 10)
For c = 1 To UBound(ys, 2)
If ys(1, c) = a Then brr(i, c) = a
Next
Next
Next
For s = 1 To UBound(drr)
Set d = CreateObject("scripting.dictionary")
For k = 1 To UBound(drr, 2)
d(drr(s, k)) = d(drr(s, k)) + 1
Next
ReDim Preserve crr(1 To UBound(drr), 1 To 10)
For ii = 0 To d.Count
If d.Item(ii) > 1 Then
crr(s, ii + 1) = d.Item(ii)
End If
Next
Set d = Nothing
Next
ReDim Preserve zrr(1 To UBound(brr), 1 To 10)
For i = 1 To UBound(brr)
For j = 1 To UBound(crr, 2)
If crr(i, j) = "" Then
zrr(i, j) = brr(i, j)
Else
zrr(i, j) = brr(i, j) & " " & crr(i, j)
End If
Next
Next
Application.ScreenUpdating = False
Sheet1.Range("F4:O" & r).ClearContents
Sheet1.[F4].Resize(UBound(zrr), 10) = zrr
For Each Rng In Sheet1.Range("F4:O" & r)
If Len(Rng) = 3 Then
With Rng.Characters(Start:=2, Length:=2).Font
.Name = "宋体"
.FontStyle = "加粗"
.Size = 18
.Color = vbRed
.Superscript = True
End With
End If
Next
Application.ScreenUpdating = True
End Sub
|
|