|
楼主 |
发表于 2012-11-9 10:12
|
显示全部楼层
suye1010 发表于 2012-11-8 20:51
提供一个思路……剩下的自己组织吧
非常谢谢。在您的引导下,我瞎蒙出了需要的效果。
Cells.Interior.ColorIndex = 0
Dim d, b, i%, j%, T%, arr
Set d = CreateObject("Scripting.Dictionary")
Set b = CreateObject("Scripting.Dictionary")
For i = 1 To 11
T = (Len(Cells(3, 6)) - Len(Replace(Cells(3, 6), Format(i, "00"), ""))) \ 2
If d.exists(T) Then
d(T) = d(T) & "," & Format(i, "00")
Else
d.Add T, Format(i, "00")
End If
Next i
If Cells(3, 6).Value <> "" Then
Cells(3, 7) = Application.WorksheetFunction.Large(d.keys, 1)
Cells(3, 8) = d(Cells(3, 7).Value)
If InStr(Cells(3, 8), Cells(3, 3)) Then Cells(3, 8).Interior.ColorIndex = 3
Cells(3, 9) = Application.WorksheetFunction.Large(d.keys, 2)
Cells(3, 10) = d(Cells(3, 9).Value)
If InStr(Cells(3, 10), Cells(3, 3)) Then Cells(3, 10).Interior.ColorIndex = 3
Else
Cells(3, 7).Value = "空"
Cells(3, 8).Value = "空"
Cells(3, 9).Value = "空"
Cells(3, 10).Value = "空"
End If
For i = 1 To 11
T = (Len(Cells(6, 6)) - Len(Replace(Cells(6, 6), Format(i, "00"), ""))) \ 2
If b.exists(T) Then
b(T) = b(T) & "," & Format(i, "00")
Else
b.Add T, Format(i, "00")
End If
Next i
If Cells(6, 6).Value <> "" Then
Cells(6, 7) = Application.WorksheetFunction.Small(b.keys, 1)
Cells(6, 8) = b(Cells(6, 7).Value)
If InStr(Cells(6, 8), Cells(3, 3)) Then Cells(6, 8).Interior.ColorIndex = 3
Cells(6, 9) = Application.WorksheetFunction.Small(b.keys, 2)
Cells(6, 10) = b(Cells(6, 9).Value)
If InStr(Cells(6, 10), Cells(3, 3)) Then Cells(6, 10).Interior.ColorIndex = 3
Else
Cells(6, 7).Value = "空"
Cells(6, 8).Value = "空"
Cells(6, 9).Value = "空"
Cells(6, 10).Value = "空"
End If
|
评分
-
查看全部评分
|