|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
何谓注释?非计算字符或者"[]"括号包含的东西。- Function Zj(s)
- s = Replace(Replace(s, "(", "("), ")", ")")
- Set x = CreateObject("MSScriptControl.ScriptControl")
- x.Language = "vbscript"
- With CreateObject("VBSCRIPT.REGEXP")
- .Global = True
- .Pattern = "\[.*?\]|[^0-9.+-/^*()]"
- Zj = x.Eval(.Replace(s, ""))
- End With
- End Function
- Public Sub BZ()‘把当前区域内标记注释为红色
- BZ01 Selection
- End Sub
- Sub BZ01(Rng As Range)
- Dim r As Range, m, i, Col, il
- Application.ScreenUpdating = False
- Application.Calculation = -4135
- Rng.Font.Color = 0
- With CreateObject("VBSCRIPT.REGEXP")
- .Global = True
- .Pattern = "\[.*?\]|[^0-9.+-/^*()()]"
- For Each r In Rng
- i = 1
- il = 0
- For Each m In .Execute(r.Value)
- i = InStr(i + il, r.Text, m.Value)
- il = Len(m.Value)
- r.Characters(i, il).Font.Color = vbRed
- Next
- Next
- End With
- Application.ScreenUpdating = True
- Application.Calculation = xlCalculationAutomatic
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|