|
- Sub test()
- last_row = Cells(Rows.Count, 5).End(xlUp).Row
- arr = Range("b6:e" & last_row)
- brr = [h4:k4]
- Set reg = CreateObject("vbscript.regexp")
- reg.Global = True
- reg.Pattern = "[^\u4e00-\u9fa5]+"
- Set dic = CreateObject("scripting.dictionary")
- For a = 1 To UBound(brr, 2)
- If Not dic.exists(brr(1, a)) Then Set dic(brr(1, a)) = CreateObject("scripting.dictionary")
- Next a
- For b = 1 To UBound(arr)
- For c = 1 To UBound(arr, 2)
- ss = reg.Replace(arr(b, c), "")
- If dic.exists(ss) Then
- If Not dic(ss).exists(arr(b, c)) Then Set dic(ss)(arr(b, c)) = CreateObject("scripting.dictionary")
- dic(ss)(arr(b, c)) = ""
- End If
- Next c
- Next b
- For d = 1 To UBound(brr, 2)
- drr = dic(brr(1, d)).keys
- Cells(6, "m").Offset(0, k).Resize(UBound(drr) + 1) = Application.Transpose(drr)
- k = k + 1
- Next d
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|