excel vba Move a shape to the last row

The solution for “excel vba Move a shape to the last row” can be found here. The following code will assist you in solving the problem.

Sub MoveButton()
Dim ws As Worksheet
Dim lr As Long
Dim buttonCell As Range
Dim shp As Shape
Set ws = Sheets(“Sheet1”) ‘Sheet where shape is inserted
lr = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1 ‘first empty row in column A
Set buttonCell = ws.Cells(lr, “A”) ‘setting the cell where button will be placed
Set shp = ws.Shapes(“myShape”) ‘name of the shape is “myShape”, change it as per your requirement
‘set the shape dimensions
With shp
.Left = buttonCell.Left
.Top = buttonCell.Top
End With
End Sub

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts