Excel) (CellFormat.Font 屬性
會傳回 Font 物件,允許使用者根據儲存格的字型格式來設定或傳回搜尋準則。
語法
運算式。字體
表達 代表 CellFormat 物件的 變數。
範例
本範例設定搜尋準則以識別含有紅色字型的儲存格,並建立據此條件的儲存格,尋找此儲存格,然後通知使用者。
Sub SearchCellFormat()
' Set the search criteria for the font of the cell format.
Application.FindFormat.Font.ColorIndex = 3
' Set the color index of the font for cell A5 to red.
Range("A5").Font.ColorIndex = 3
Range("A5").Formula = "Red font"
Range("A1").Select
MsgBox "Cell A5 has red font"
' Find the cells based on the search criteria.
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True).Activate
MsgBox "Microsoft Excel has found this cell matching the search criteria."
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應