|
- Sub chan()
- Dim rng As Range
- Dim objReg As Object, strVal As String, objMatchs As Object, objMatch As Object
- Dim intStart As Integer, intLen As Integer
-
- Set objReg = CreateObject("vbscript.regexp")
- objReg.Global = True
- objReg.Pattern = "\d+"
-
- For Each rng In [A3:A15]
- strVal = rng.Text
- Set objMatchs = objReg.Execute(strVal)
- For Each objMatch In objMatchs
- intStart = objMatch.FirstIndex + 1
- intLen = objMatch.Length
- With rng.Characters(intStart, intLen).Font
- .Size = 24
- .Color = vbBlue
- End With
- Next
- Next
- End Sub
复制代码 |
|