0

I want to move a shape to a different sheet, without using copy and paste in the macro. Is there another way to do this?

Matt Cann
  • 53
  • 1
  • 6

1 Answers1

0

If the shape is a chart object, you can just change its location:

ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet2"

For all other types of shapes, there is no location property or move method. If you want to avoid copying and pasting, then you'll need to create a new shape on the new sheet and copy across all relevant properties, then delete the original.

Sub MoveShape()

    Dim shp1 As Shape, shp2 As Shape

    Set shp1 = Sheets("Sheet1").Shapes(1)
    Set shp2 = Sheets("Sheet2").Shapes.AddShape(shp1.Type, shp1.Left, shp1.Top, shp1.Width, shp1.Height)

    shp2.Name = shp1.Name
    shp2.Fill.ForeColor.RGB = shp1.Fill.ForeColor.RGB
    shp2.Line.Weight = shp1.Line.Weight
    shp2.Line.DashStyle = shp1.Line.DashStyle
    shp2.Line.ForeColor.RGB = shp1.Line.ForeColor.RGB

    shp1.Delete

End Sub
Michael
  • 4,563
  • 2
  • 11
  • 25