Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

Simplification code bordure

Citaro

XLDnaute Occasionnel
Bonjour au forum,
Avez vous une idée pour simplifier ce code qui à la validation d'un userform fait une bodure sur la nouvelle ligne de donnée

Merci
Citaro

Range([A65536].End(xlUp), [A65536].End(xlUp).Offset(0, 11)).Select
With Selection.Borders(xlDiagonalDown).LineStyle = xlNone
End With
With Selection.Borders(xlDiagonalUp).LineStyle = xlNone
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.Weight = xlThin
End With
 
Dernière édition:

Pierrot93

XLDnaute Barbatruc
Re : Simplification code bordure

Bonjour,

essaye peut être ceci :
Code:
With Range([A65536].End(xlUp), [A65536].End(xlUp).Offset(0, 11))
    With .Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
End With

ou peut être cela :
Code:
With Range([A65536].End(xlUp), [A65536].End(xlUp).Offset(0, 11)).Borders
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
End With

bonne journée
@+
 

Pierrot93

XLDnaute Barbatruc
Re : Simplification code bordure

Re,

un peu plus court avec un "resize"

Code:
With [A65536].End(xlUp).Resize(, 12).Borders
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
End With
 

Discussions similaires

Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…