|
本帖最后由 闪存不足 于 2011-10-27 17:40 编辑
测试一下附件看符合要求吗?
批量删除字符串中不同字号的字符串.zip
(9.37 KB, 下载次数: 49)
- Sub Test()
- Dim Nbr As Integer
- Dim Letter As Integer
- Dim StartLen As Integer
- Dim CutLen As Integer
-
- For Nbr = 2 To [A65536].End(3).Row
- With Cells(Nbr, 1)
- For Letter = 2 To Len(Cells(Nbr, 1))
- If .Characters(Start:=Letter, Length:=1).Font.Size = 18 Then
- If .Characters(Start:=Letter - 1, Length:=1).Font.Size <> 18 Then StartLen = Letter
- If .Characters(Start:=Letter + 1, Length:=1).Font.Size <> 18 Then
- CutLen = Letter - StartLen + 1
- Exit For
- End If
- End If
- Next
- Cells(Nbr, 2) = Mid(.Value, StartLen, CutLen)
- End With
- Next Nbr
- End Sub
复制代码 |
|