VBA Code to move a shape in Excel and retrieve its location
Before the macro:
After the macro:
Sub MoveShape_down()
Dim s As Range
With ActiveSheet.Shapes("My_shape") '= name of the shape you want to move in Excel
Set s = .TopLeftCell 'current position of the shape
.Top = s.Offset(1, 0).Top 'tell the shape to move 1 cell down
.Left = s.Offset(0, 0).Left 'tell the shape to not move right or left
End With
Range("C3") = s.Row 'Write the current position of the shape (top left cell)
Range("C4") = s.Column
End Sub
I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..
ReplyDeleteexcel vba courses