Answers for "excel vba Move a shape to the last row"

VBA
0

excel vba Move a shape to the last row

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
Posted by: Guest on April-25-2022

Code answers related to "VBA"

Browse Popular Code Answers by Language