Objet CellFormat (Excel)

Cet objet représente les critères de recherche pour le format des cellules.

Remarques

Utilisez les propriétés FindFormat ou ReplaceFormat de l’objet Application pour renvoyer un objet CellFormat .

Utilisez les propriétés Borders, Font ou Interior de l’objet CellFormat pour définir les critères de recherche pour le format de cellule.

Exemple

L'exemple suivant montre comment définir les critères de recherche pour l'intérieur du format des cellules.

Sub ChangeCellFormat() 
 
 ' Set the interior of cell A1 to yellow. 
 Range("A1").Select 
 Selection.Interior.ColorIndex = 36 
 MsgBox "The cell format for cell A1 is a yellow interior." 
 
 ' Set the CellFormat object to replace yellow with green. 
 With Application 
 .FindFormat.Interior.ColorIndex = 36 
 .ReplaceFormat.Interior.ColorIndex = 35 
 End With 
 
 ' Find and replace cell A1's yellow interior with green. 
 ActiveCell.Replace What:="", Replacement:="", LookAt:=xlPart, _ 
 SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=True, _ 
 ReplaceFormat:=True 
 MsgBox "The cell format for cell A1 is replaced with a green interior." 
 
End Sub

Méthodes

Propriétés

Voir aussi

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.