ActiveSheet.ChartObject - doesn't move perfectly.

ififthelement

New Member
Joined
Sep 11, 2014
Messages
48
Hi,

I have a shape object (Rectangle - transparent) inside which i have Excel Line charts (referred by ChartObject). There are 4 charts inside this Rectangle. All of these are Grouped. The chart at the bottom that i want to specify with TOP/Left/Width/Height, based on the available space on the sheet, consumes the properties well but only at the first attempt correctly.

Next time when i hit reposition, it move a little further upwards and so on.

Reposition has the code given below:

Code:
With ActiveSheet.ChartObjects("DefectTrend")
            .Left = 8.2
            .Width = 1140
            .Top = 1360
            .Height = 325
End With

There are few charts above DefectTrend chart object. so each time i reposition, it moves upwards & overlaps the chart above it.

any suggestions :confused:
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi All,

I attempted in a new sheet with 2 new charts in it. So, If I use the code below:

Code:
Sub Button1_Click()    ActiveSheet.ChartObjects("chart 1").Activate
    ActiveSheet.ChartObjects("chart 1").Left = 50
    ActiveSheet.ChartObjects("chart 1").Top = 100
    
    ActiveSheet.ChartObjects("chart 2").Activate
    ActiveSheet.ChartObjects("chart 2").Left = ActiveSheet.ChartObjects("chart 1").Left + ActiveSheet.ChartObjects("chart 1").Width + 50
    ActiveSheet.ChartObjects("chart 2").Top = ActiveSheet.ChartObjects("chart 1").Top
End Sub

WHEN:
A) 2 charts that are not grouped - it works perfect in re arranging as per the values given above. If i Keep on hitting the Button1, then it places the 2 charts exactly at the specified left & top

B) If I group these 2 charts - the problem starts here. The above code keeps shrinking the charts widths upon clicking the Button1 repeatedly.:confused::eek:
 
Upvote 0

Forum statistics

Threads
1,217,346
Messages
6,136,029
Members
449,979
Latest member
trinitybg10

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