|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 xwdys 于 2016-2-5 16:28 编辑
改进一下,如果文中出现数字,则不替换:
- Sub Test()
- Application.ScreenUpdating = False
-
- Selection.HomeKey Unit:=wdStory
- Selection.Find.ClearFormatting
-
- With Selection.Find
- .Text = "^13第[0-9]{1,4}章"
- .MatchWildcards = True
- End With
-
- Do While Selection.Find.Execute
- With Selection
- .SetRange .Start + 2, .End - 1
- .Fields.Add .Range, -1, "= " & .Text & "\* CHINESENUM3", False
- End With
- Loop
-
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|