|
- Sub text()
- Dim arr, i%, dic, k, n%, r%, s%, sh
- Set dic = CreateObject("scripting.dictionary")
- With Sheet1
- arr = .[a1].CurrentRegion
- n = 0
- For i = 1 To UBound(arr) - 1
- If arr(i, 3) <> arr(i + 1, 3) Then n = i + 1
- dic(n & "|" & arr(i + 1, 3)) = dic(n & "|" & arr(i + 1, 3)) + 1
- Next i
- For Each k In dic.keys
- r = Split(k, "|")(0)
- s = WorksheetFunction.Round(dic(k) * 0.1, 0)
- If s < 1 Then s = 1
- Set sh = Range("a" & r).Resize(s, 5)
- sh.Interior.ColorIndex = 6
- Set sh = Nothing
- Next k
- End With
- Set dic = Nothing
- End Sub
复制代码 |
|