![](/img/trans.png)
[英]How can I modify (change to bold) a specific string of text in a merged cell in Microsoft Excel VBA?
[英]How i can add to existing cell additional text with modified font options in Microsoft Excel VBA
例如,Microsoft VBA:
ActiveCell = ActiveCell & <Some Text i want to add with option Size = 20>
我如何在“ <>”括號內實現該描述
您想要更改ActiveCell.Characters()。Font屬性
Dim CurrentText, SomeText
Dim CurrentTextLen, SomeTextLen
CurrentText = ActiveCell.Value
CurrentTextLen = Len(CurrentText)
SomeText = "Some Text i want to add with option Size = 20"
SomeTextLen = Len(SomeText)
ActiveCell.Value = CurrentText & SomeText
With ActiveCell.Characters(Start:=CurrentTextLen + 1, Length:=SomeTextLen).Font
.Size = 20
End With
為此,您需要知道<>文本的起始位置(即ActiveCell當前內容的長度加一)。
您還需要<>文本的長度(即<>文本的長度)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.