-
EXCEL > VBA > faire plusieurs actions sur la même cellule
GENERALITE
With objet .property End With
EXEMPLES
Exemple 1
Au lieu d’écrire :
ActiveCell(1,2).Value = "F" ActiveCell(1,2).HorizontalAlignment = xlCenter ActiveCell(1,3).Value = "Terrible - needs attention"
on peut écrire :
WITH ActiveCell(1,2) .Value = "F" .HorizontalAlignment = xlCenter .Value = "Terrible - needs attention" END WITH
Exemple 2
With Range("A1:G1") .Merge .HorizontalAlignment = xlCenter End With
Exemple 3
With ActiveCell.Font .Bold = True .Color = vbBlue .Name = "Arial" .Size = 22 .Italic = True End With