Combiner 2 WITH

Salut le forum,

y'a-t-il une façon de combiner ces 2 WITH?

With Sheets(i).Range("A1:L1").Font
            .Name = "Bookman Old Style"
            .FontStyle = "Gras"
            .Size = 12
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ThemeColor = xlThemeColorDark1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontNone
        End With

With Sheets(i).Range("A1:L1")
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
End With

Et est-ce que je dois mentionner tous les éléments ou certains ont une valeur par défaut?

Merci pour votre aide.

2majdoc.xlsm (61.37 Ko)

Je crois que j'y suis.

Je n'ai qu'à ajouter .Font devant tous les éléments concernant cette condition.

With Sheets(i).Range("A1:L1")
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .IndentLevel = 0
            .ShrinkToFit = False
            .ReadingOrder = xlContext
            .MergeCells = False
            .Font.Name = "Bookman Old Style"
            .Font.FontStyle = "Gras"
            .Font.Size = 12
            .Font.Strikethrough = False
            .Font.Superscript = False
            .Font.Subscript = False
            .Font.OutlineFont = False
            .Font.Shadow = False
            .Font.Underline = xlUnderlineStyleNone
            .Font.ThemeColor = xlThemeColorDark1
            .Font.TintAndShade = 0
            .Font.ThemeFont = xlThemeFontNone
End With

Mais est-ce que je dois mentionner tous les éléments ou certains ont une valeur par défaut?

sans titre

Salut le forum

Eric ceci suffit

With Sheets(i).Range("A1:L1")
  .HorizontalAlignment = xlCenter
    With .Font
      .Name = "Bookman Old Style"
      .FontStyle = "Gras"
      .Size = 12
    End With
End With

Mytå

Salut Mytå,

merci d'éclairer ma lanterne.

Rechercher des sujets similaires à "combiner"