Share via


CellFormat.Font, propriété (Excel)

Renvoie un objet Font , ce qui permet à l’utilisateur de définir ou de renvoyer les critères de recherche en fonction du format de police de la cellule.

Syntaxe

expression. Polices

Expression Variable qui représente un objet CellFormat .

Exemple

Cet exemple montre comment définir les critères de recherche pour identifier les cellules qui contiennent une police rouge, créer une cellule répondant à ce critère, trouver cette cellule et avertir l'utilisateur.

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

Assistance et commentaires

Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.