任何人都可以帮助我解决 Excel 问题吗?我有一个充满文本的单元格。本文本中的一些文字以粗体印刷。这些词是关键字,应提取到行中的另一个单元格以识别关键字。例子:
单元格中的文本:
我想使用谷歌 地图获取路线信息
输出:
谷歌; 地图;路线;
先感谢您!
您也可以使用此 UDF 产生相同的结果。请在模块中输入以下代码。
Public Function findAllBold(ByVal rngText As Range) As String
Dim theCell As Range
Set theCell = rngText.Cells(1, 1)
For i = 1 To Len(theCell.Value)
If theCell.Characters(i, 1).Font.Bold = True Then
If theCell.Characters(i + 1, 1).Text = " " Then
theChar = theCell.Characters(i, 1).Text & ", "
Else
theChar = theCell.Characters(i, 1).Text
End If
Results = Results & theChar
End If
Next i
findAllBold = Results
End Function
Run Code Online (Sandbox Code Playgroud)
现在您可以使用新创建的函数从任何单元格返回粗体值。