|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub qs()
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet1.[a1].CurrentRegion.Value
- For i = 2 To UBound(arr)
- s = arr(i, 2)
- a = Split(arr(i, 1), "楼")
- s2 = a(0) & "楼"
- If Not dic.exists(s) Then
- dic(s) = s2
- Else
- b = Split(dic(s), "/")
- m = 0
- For Each b2 In b
- If b2 = s2 Then m = m + 1
- Next
- If m = 0 Then
- dic(s) = dic(s) & "/" & s2
- End If
- End If
- Next
- k = dic.keys
- ii = dic.items
- [d3].Resize(dic.Count, 2) = Application.WorksheetFunction.Transpose(Array(dic.keys, dic.items))
- Set dic = Nothing
- End Sub
复制代码 |
|