|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Column < 8 Then
- Dim arr, dic, i As Long, a, b, c, t
- Set dic = CreateObject("scripting.dictionary")
- arr = [a1].CurrentRegion
- For i = 1 To UBound(arr)
- For a = 2 To 5
- For b = a + 1 To 6
- For c = b + 1 To 7
- t = Right(0 & arr(i, a), 2) & " " & Right(0 & arr(i, b), 2) & " " & Right(0 & arr(i, c), 2)
- dic(t) = dic(t) + 1
- Next c, b, a, i
- With Sheet2
- .[a:b] = ""
- .[a1].Resize(dic.Count) = WorksheetFunction.Transpose(dic.keys)
- .[b1].Resize(dic.Count) = WorksheetFunction.Transpose(dic.items)
- .[a:b].Sort .[a1]
- End With
- Set dic = Nothing
- End If
-
复制代码 |
|