|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
这样能用了 和自己的代码对比一下 问题较多 有的问题可能复杂化了
不建议开始就弄这么复杂
- Sub 结果()
- '正则 (".[F12], .[K5], .[N24]")
- 正则 Array([f12], [k5], [n24])
- End Sub
- Sub 正则(Key)
- Dim regText As Object, kr, cr, i, j, K
- Dim Mhs, Mh
- Dim rng As Range
- Application.ScreenUpdating = False
- Cells.Font.ColorIndex = xlAutomatic
- kr = Array("【", "】")
- cr = Array("3", "5")
- 'srr = Split(Key, ",")
- With Sheets("Sheet1")
- For K = 0 To UBound(Key)
- Set regText = CreateObject("vbscript.regexp")
- With regText
- .Pattern = VBA.Join(kr, "[^" & VBA.Join(kr, "") & "]*")
- .Global = True
- End With
- For Each rng In Key(K)
- If regText.test(rng) Then
- Set Mhs = regText.Execute(rng)
- For Each Mh In Mhs
- With rng.Characters(Mh.FirstIndex + 1, Mh.FirstIndex + Mh.Length - 1).Font
- .Bold = True
- .ColorIndex = 3
- .Bold = True
- .Size = 15
- End With
- Next
- End If
- Next
- Next
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 一时半会难以全部说清,对比不同,找问题。
其他具体问题再具体交流。
|
评分
-
1
查看全部评分
-
|