[Aide] Résumer une macro à un simple code

INFINITY100

XLDnaute Occasionnel
Bonjour à tous

Voila ma question est très simple j'ai sous la main une macro que j'ai créée via l'enregistreur de macro Excel et elle exécute certaines manœuvres que je voudrai avoir sauf que à la fin j'ai pas aimé le code de la macro du coup je cherche à le résumer à un code plu commode et professionnel.

Donc quelqu'un peut-il me résumer le code ci-dessous

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Range("F24").Select

With Selection
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlCenter
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 1
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Color = -16777024
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Color = -16777024
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Color = -16777024
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Color = -16777024
        .TintAndShade = 0
        .Weight = xlMedium
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    With Selection.Font
        .Name = "Tahoma"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontNone
   End With
End Sub

Merci à vous tous

Cordialement
 

JCGL

XLDnaute Barbatruc
Re : [Aide] Résumer une macro à un simple code

Bonjour à tous,

Peux-tu essayer ceci :

VB:
Private Sub Worksheet_Change(ByVal Target As Range)


    With Range("F24")
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlCenter
        With .Borders
            .LineStyle = xlContinuous
            .Color = -16777024
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        .Borders(xlEdgeTop).Weight = xlThin
        .Borders(xlEdgeBottom).Weight = xlThin
        With .Font
            .Name = "Tahoma"
            .Size = 11
            .ThemeColor = xlThemeColorLight1
            .TintAndShade = 0
            .ThemeFont = xlThemeFontNone
        End With
    End With
End Sub

A+ à tous
 

Discussions similaires

Statistiques des forums

Discussions
312 197
Messages
2 086 104
Membres
103 118
dernier inscrit
mlaf4032