情況:
我有一個包含這個公式的單元格:
="巴黎制造,"&TEXTE(AUJOURDHUI();"jj/mm/aaaa")&"。"
結果是:
巴黎制造,2022 年 3 月 23 日。
我解決問題的方法:
Worksheets("AAA").Range("C8").Characters(30, 66).Font.Bold = True
它不起作用,因為有一個公式,我想……
現在我需要你們幫助使它看起來像:
巴黎制造,2022年 3 月 23 日。
提前致謝。
uj5u.com熱心網友回復:
您不能使用單元格中的公式來執行此操作。但是您可以將公式放入 VBA 宏中。您可以觸發宏在某些事件上運行,或者手動觸發它。
例如:
Option Explicit
Sub boldDate()
Dim r As Range
Const sText As String = "Made in Paris, "
Dim sResult As String
Dim Start As Long, Length As Long
Start = Len(sText) 1
Length = 10
Set r = Selection 'Or specify the cell where you want this written.
With r
.Value = sText & Format(Date, "dd/mm/yyyy")
.Characters(Start, Length).Font.Bold = True
End With
End Sub

轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/448404.html
上一篇:回圈從不同的范圍/表格制作圖表
