|
- Sub aa()
- Dim regex, d, i
- Dim matchs, match
- Set regex = CreateObject("vbscript.regexp")
- Set d = CreateObject("Scripting.Dictionary")
- Range("b2:b65536").ClearContents
- With regex
- .Global = True
- .Pattern = "\b[a-zA-Z]+\b"
- For i = 2 To Range("a65536").End(xlUp).Row
- Set matchs = .Execute(Range("a" & i).Value)
- For Each match In matchs
- d(match & "") = d(match & "") + 1
- Next
- Next
- End With
- [b2].Resize(d.Count, 1) = Application.Transpose(d.Keys)
- [c2].Resize(d.Count, 1) = Application.Transpose(d.Items)
- Set matchs = Nothing
- Set regex = Nothing
- Set d = Nothing
- End Sub
复制代码 |
|