cle*_*vor 1 excel vba excel-vba excel-2010
我有一个包含文本" Collar Lot# " 的单元格,我想在其末尾添加一个非粗体字符串.一个例子是" Collar Lot# 23456\34567\45678".我的下面的代码尝试使整个字符串变粗,导致" Collar Lot#23456\34567\45678 "
With Workbooks(ThisWorkbook.name).Worksheets(1)
...
.Cells(7, 5).value = "Collar Lot # " & "23456\34567\45678"
End With
Run Code Online (Sandbox Code Playgroud)
我如何确保"23456\34567\45678"不是大胆的?
小智 5
您需要使用以下内容基于字符的位置指定格式:
.Cells(7, 5).Characters(Start:=1, Length:=13).Font.FontStyle = "Bold"
Run Code Online (Sandbox Code Playgroud)