Move Rectangle Shape to specific co-ordinates

Tobbes

New Member
Joined
Feb 26, 2009
Messages
47
I am wondering if there is a way to use code to move a rectangle to a specific location on a sheet.

I can only use "ShapeRange.IncrimentLeft" so far...which only move the shape to the left every time.

Is there anyway to move a shape to point that no matter where the shape is it will always make it it to this location.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You can use dTop and Dleft to locate the shape.
Change the vaules to suit
Code:
Sub MovPics()
Dim dTop As Double, dLeft As Double
dTop = 20               ' Top of the first shape
dLeft = 50              ' Left of the first shape
        With ActiveSheet.Shapes("Rectangle 1")
            .Left = dLeft
            .Top = dTop
        End With
End Sub
 
Last edited:
Upvote 0
Thanks very much. It was the .Left and .Top commands I was after.

Is there a similar function for Height and Width?
 
Upvote 0
Try, and adjust accordingly.
All
Code:
 ShapeRange.ScaleWidth 0.74, msoFalse, msoScaleFromBottomRight
 .ShapeRange.ScaleHeight 0.57, msoFalse, msoScaleFromTopLeft
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,681
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top