有人可以帮助我吗?
我有一个字符串: CLR 。 CLR是最...
我想获得粗体字的长度
答案 0 :(得分:1)
您可以修改以下内容:
Option Explicit
Sub test()
Dim j As Long, Count As Long
With ThisWorkbook.Worksheets("Sheet1") 'Change sheet name if needed
'Lets say string appears in cell A1
For j = 1 To Len(.Range("A1").Value)
If .Range("A1").Characters(j, 1).Font.FontStyle = "Bold" Then
Count = Count + 1
End If
Next j
Debug.Print Count
End With
End Sub