Chart height and width ??

mridul_kapoor

New Member
Joined
Nov 22, 2010
Messages
24
Hi,

Here is my code which I am using to fix the location, height and width of the chart.

Code:
        ActiveChart.ChartArea.Select
        ActiveSheet.Shapes("CHART_XY_1").Left = Cells(1, 1).Left
        ActiveSheet.Shapes("CHART_XY_1").Top = Cells(1, 12).Top
        ActiveChart.Parent.Width = Cells(1, 13).Left - Cells(1, 1).Left
        ActiveChart.Parent.Height = Cells(19, 1).Top - Cells(1, 1).Top

Now the problem I am facing is with function "cells()" which is working fine on excel 2010 but somehow it is giving error on excel 2007.

can some1 tell me what wrong m I doing?
or any other way to fix the location, height and width of chart??

ps: I have to display 4 chart on the same screen , keeping 1 at every 4 corners and also height n width being half of what the screen size is.

Thanks in advance
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi

If I understand correctly you want the chart to overlap the range A1:L18.

I'd do it like this:

Code:
Sub ChartPos()
Dim r As Range
Dim chtO As ChartObject
 
With ActiveSheet
    Set r = .Range("A1:L18")
    Set chtO = .ChartObjects("CHART_XY_1")
End With
 
With chtO
    .Left = r.Left
    .Top = r.Top
    .Width = r.Width
    .Height = r.Height
End With
 
End Sub
 
Upvote 0
Hi PGC,
Thanks for the reply.
I just tried this and is working
Code:
       Dim RangeX1Y1 As Range
        Set RangeX1Y1 = ActiveSheet.Range("A23:H38")
        With ActiveSheet.ChartObjects("CHART_X1Y1")
            .Left = RangeX1Y1.Left
            .Top = RangeX1Y1.Top
            .Width = RangeX1Y1.Width
            .Height = RangeX1Y1.Height
        End With
        ActiveChart.ChartArea.Select

I just wanted to overlap on the given particular range.

btw if thrs a button in between that range then will the chart overlap it as well??
 
Upvote 0
btw if thrs a button in between that range then will the chart overlap it as well??

I have checked it it 2003, 2007 and 2010.
The chart tend to overlap button or comobobox or check box in 2003 and 2010 but not in 2007.
Do we have a fix for this?:confused:
I tried this

Code:
ActiveSheet.ChartObjects("CHART_XY_1").BringToFront

but it doesnt seem to work.
Even I am not able to bring the chart manually.:confused:
 
Upvote 0
Unfortunately I cannot test in excel 2007.

Did you try the opposite? Right-click on the button, Order, Send to Back.
 
Upvote 0
yes, I did try everything. Sending button back, bringing chart forward, not helping ;)
I dont understand why is it working on 2003 and 2010 and nt 2007?:confused:
 
Upvote 0
This file was made in excel 2003.
I am using excel 2010 now and I made this file backward compatible to 97-2003.
Not able to do anything on this:confused:
 
Upvote 0
gt d solution to my question but not the problem...
in excel 2007, buttons or any type of form controls have more priority than a chart, hence a button is always on top of chart and it wont go manually even. This problem has been rectified in excel 2010 which works just fine with form controls and chart...
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,291
Members
448,564
Latest member
ED38

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