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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈