Structures de contrôles VBAWith End With
Bloc d'instruction With End With
Exemple: Ecrire la date du jour dans la cellule active
Sub BlocWith()
With ActiveCell
.Value = Date
.Interior.Color = RGB(255, 255, 204)
With .Font
.Color = RGB(0, 51, 102)
.Italic = True
.Bold = True
.Name = "Comic sans MS"
' par contre ici vous ne pouvez écrire .NumberFormatLocal = "jjjj j mmmm aaaa"
End With
.NumberFormatLocal = "jjjj j mmmm aaaa"
End With
End Sub
With ActiveCell
.Value = Date
.Interior.Color = RGB(255, 255, 204)
With .Font
.Color = RGB(0, 51, 102)
.Italic = True
.Bold = True
.Name = "Comic sans MS"
' par contre ici vous ne pouvez écrire .NumberFormatLocal = "jjjj j mmmm aaaa"
End With
.NumberFormatLocal = "jjjj j mmmm aaaa"
End With
End Sub


