Bonjour Amandine, Abel
A mon avis, Abel n’a pas tort d’utiliser l’enregistreur de Macro.
Car, si pendant l’enregistrement vous changez la bordure d’une cellule et la couleur du fond, lorsque vous éditez la macro vous avez les propriétés qui vous intéressent. Il reste à adapter le code.
Exemple
Pour la cellule A2 recopiant les bordures et la trame de fond de la cellule A1
Un exemple brut (brute aussi)
'pour la couleur du fond
Cells(2, 1).Interior.ColorIndex = Cells(1, 1).Interior.ColorIndex
Cells(2, 1).Interior.Pattern = Cells(1, 1).Interior.Pattern
Cells(2, 1).Interior.PatternColorIndex = Cells(1, 1).Interior.PatternColorIndex
'pour la bordure gauche
Cells(2, 1).Borders(xlEdgeLeft).LineStyle = Cells(1, 1).Borders(xlEdgeLeft).LineStyle
Cells(2, 1).Borders(xlEdgeLeft).Weight = Cells(1, 1).Borders(xlEdgeLeft).Weight
Cells(2, 1).Borders(xlEdgeLeft).ColorIndex = Cells(1, 1).Borders(xlEdgeLeft).ColorIndex
'pour la bordure droite
Cells(2, 1).Borders(xlEdgeRight).LineStyle = Cells(1, 1).Borders(xlEdgeRight).LineStyle
Cells(2, 1).Borders(xlEdgeRight).Weight = Cells(1, 1).Borders(xlEdgeRight).Weight
Cells(2, 1).Borders(xlEdgeRight).ColorIndex = Cells(1, 1).Borders(xlEdgeRight).ColorIndex
'pour la bordure haute
Cells(2, 1).Borders(xlEdgeTop).LineStyle = Cells(1, 1).Borders(xlEdgeTop).LineStyle
Cells(2, 1).Borders(xlEdgeTop).Weight = Cells(1, 1).Borders(xlEdgeTop).Weight
Cells(2, 1).Borders(xlEdgeTop).ColorIndex = Cells(1, 1).Borders(xlEdgeTop).ColorIndex
'pour la bordure basse
Cells(2, 1).Borders(xlEdgeBottom).LineStyle = Cells(1, 1).Borders(xlEdgeBottom).LineStyle
Cells(2, 1).Borders(xlEdgeBottom).Weight = Cells(1, 1).Borders(xlEdgeBottom).Weight
Cells(2, 1).Borders(xlEdgeBottom).ColorIndex = Cells(1, 1).Borders(xlEdgeBottom).ColorIndex
Je pense que cela devrais suffire pour comprendre le principe de base, je vous laisse mettre des variables pour le décalage souhaité.
Au revoir, à bientôt.