我想打印出一张Excel工作表,其中将有一个包含大量文本的列。在此文本内,我想用粗体突出显示一些特定的单词吗?
['B1'] =文字文字文字文字文字文字文字文字粗体文字文字文字
到现在为止,我还只是找到了将孔单元格“ B1”更改为另一种格式的方法。有人知道如何以其他方式突出显示单个单词吗?例如其他颜色,斜体或换行符?
谢谢! :)
最佳答案
好的,因为您也可以按照评论接受VBA
解决方案-我给您提供了一个使文本部分加粗的最小示例
Sub MakeTextBold()
' Assume that the required text is in cell A1
ActiveSheet.Range("A1").Select
' Assume that the text you want to make bold starts from
' position 6 in your cell and number of char to be bold = 2
With ActiveCell.Characters(Start:=6, Length:=2).Font
.FontStyle = "Bold"
End With
End Sub
您可以在此示例的基础上构建-通过
将范围更改为所需范围
找出指定要加粗的字符的起始位置和长度的方法。