bonjour
Pour la seconde feuille.
, mais si tu dois utilsier ça souvent, une procédure adapter à n'importqu'eulle tableau serait mieux
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
' Macro créée par G.Mourmant le 01/09/2001
'
http://www.polykromy.com/nl/nl6/nl6.html
'Stop
'*** Définition des variables ***
w = ActiveCell.Width
h = ActiveCell.Height
t = ActiveCell.Top
l = ActiveCell.Left
dw = Cells(5, 4).Left
w1 = ActiveCell.Offset.Left - dw
dh = Cells(6, 6).Top
h1 = ActiveCell.Top - dh
Debug.Print ActiveCell.Address, "h=" & h, "w2=" & w2, "t=" & t, "w=" & w
If Not Application.Intersect(Target, [D6:N20]) Is Nothing Then
'Teste si les rectangles existent déjà.
On Error Resume Next
ActiveSheet.Shapes("RectangleV").Delete
On Error Resume Next
ActiveSheet.Shapes("RectangleH").Delete
On Error GoTo 0
'Ajoute les rectangles
ActiveSheet.Shapes.AddShape(msoShapeRectangle, dw, t, w1, h).Name = "RectangleH"
With ActiveSheet.Shapes("RectangleH")
.Fill.Visible = msoFalse
.Fill.Transparency = 0#
.Line.Weight = 2# '3#
.Line.ForeColor.SchemeColor = 3 '10
.ControlFormat.PrintObject = False
End With
ActiveSheet.Shapes.AddShape(msoShapeRectangle, l, dh, w, h1).Name = "RectangleV"
With ActiveSheet.Shapes("RectangleV")
.Fill.Visible = msoFalse
.Fill.Transparency = 0#
.Line.Weight = 3#
.Line.ForeColor.SchemeColor = 10
.ControlFormat.PrintObject = False
End With
End If
End Sub