'la couleur de trait
'peut être exprimée de toute les manières
'qui sont possibles en vba (rgb /long / hexa / etc)
'-------------------------
'l'arrondi de 0 a 100
100 = le rayon = a la moitié du plus petit coté
'-------------------------
Style trait
'1 = plein
'2 = pointillet point
'4 = pointillet trait
'ou les constantes XL
'------------------------
Sub test()
'Argument [range] , [couleur du trait] , [pourcentage de l'arrondi de 0 à 100] , [style du trait]
roundCornerBorderArround [B5:C8], vbRed, 20, 4
End Sub
Function roundCornerBorderArround(cel As Range, Optional coul As Long = 0, Optional RoundCorner As Long = 1, Optional LinXStyle As Long = xlDashDot)
Dim shap As Shape
Set shap = ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, cel.Left, cel.Top, cel.Width, cel.Height)
With shap
.Line.ForeColor.RGB = coul
.Line.DashStyle = LinXStyle
.Fill.Visible = msoFalse 'pour pouvoir quand meme selectionner les cellules
.Placement = xlMoveAndSize
.Adjustments(1) = RoundCorner / 100
End With
End Function