|
- Sub test()
- '以工作表2数据为例
- Dim cel As Range, c As Range, newstr$, regx
- Set regx = CreateObject("vbscript.regexp")
- regx.Pattern = "[一-龥]+": regx.Global = True
- For Each cel In ActiveSheet.Columns(1).SpecialCells(xlCellTypeConstants)
- newstr = ""
- Set mh = regx.Execute(cel.Value)
- For Each s In mh
- Set c = Sheets(2).Columns(4).Find(s, lookat:=xlWhole)
- If Not c Is Nothing Then
- If c.Offset(0, -2) = "重点词*" Then newstr = "[" & c.Value & "]" & newstr _
- Else newstr = newstr & "[" & c.Value & "]"
- End If
- Next
- If Len(newstr) <> 0 Then cel.Value = newstr
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|