sub insertion_objet_rectangle()
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 120, 15, 94.5, 38.25).Select
'AddShape( Type , Left , Top , Width , Height )
End sub
Sub addshapetocell()
Dim clLeft As Double
Dim clTop As Double
Dim clWidth As Double
Dim clHeight As Double
Dim cl As Range
Dim my_shape As Shape
Set cl = Range(Selection.Address)
clLeft = cl.Left
clTop = cl.Top
clHeight = cl.Height
clWidth = cl.Width
Set my_shape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, clLeft, clTop, 90, 40)
End Sub
Sub M_Shape()
Dim shp As Shape, r As Range
Set r = Range("c8")
ActiveSheet.DrawingObjects.Delete
Set shp = ActiveSheet.Shapes.AddShape(msoShapeRectangle, r.Left, r.Top, 5, 5)
'juste pour exemple
MsgBox shp.Name
End Sub
bonjour tout le monde,
je souhaite inserer un shape (rectangle par exemple) mais un endroit precis.
l'insertion est à l'angle supérieur gauche de la cellule C2. sachant que la largeur des colonnes sont ajustables.
merci de votre aide
With ActiveSheet.Shapes("rectangle 1")
.Left=[C2].Left
.Top=[C2].Top
End with
Sub M_ShapeII()
Dim r As Range: Set r = Range("C8")
ActiveSheet.DrawingObjects.Delete
With r
ActiveSheet.Shapes.AddShape 1, .Left, .Top, .Width, .Height
End With
End Sub
Sub addshapetocell()
Set my_shape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, ActiveCell.Left, ActiveCell.Top, 90, 40)
End Sub