Excel Moving Graphs

shivam03

Board Regular
Joined
Nov 22, 2010
Messages
86
Hi there,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I hope you are all well.<o:p></o:p>
<o:p></o:p>
I have created a dashboard in Excel which contains a few graphs. The worksheet is protected and the objects are locked.<o:p></o:p>
<o:p></o:p>
The problem is that when I return to the worksheet the position of the graphs in the worksheet often changes. <o:p></o:p>
<o:p></o:p>
Nothings changes in the worksheet apart from the data in the tables.<o:p></o:p>
<o:p></o:p>
Can anyone suggest why this could be happening?<o:p></o:p>
<o:p></o:p>
Kind regards,<o:p></o:p>

Shivam03<o:p></o:p>
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I can't tell you why it happens, but I've seen it happen too. One workaround is to have a macro for the workbook_open event that positions the graphs where you want them to be, usually with reference to a specific range on the sheet they're embedded in.
 
Upvote 0
Thanks.

Do you have an example of the marco I could use?

Kind regards,

Shivam
Put the module below in a regular module. Then in a 'Thisworkbook' module for the Workbook_Open event simply call the module below:
Code:
Sub PutChartOnRange(rng As Range, chtName As String)

'This routine places an embedded chart over a specific range on the worksheet
'The chart is automatically sized to cover the user-defined range called rng

ActiveSheet.ChartObjects(chtName).Activate
    With ActiveChart.Parent
        .Left = rng.Left
        .Width = rng.Width
        .Top = rng.Top
        .Height = rng.Height
    End With

End Sub
 
Upvote 0
Thanks for this, it's great.

Do you know how to work out the current location of my charts?

Thanks,

Shivam
 
Upvote 0
Thanks for this, it's great.

Do you know how to work out the current location of my charts?

Thanks,

Shivam
This will give you the position of an embedded chart (here Chart 1, change chart name to fit) in points.
Code:
Sub GetChartPosition()
Dim cT, cL, W, H
ActiveSheet.ChartObjects("Chart 1").Activate 'substitute your chart name
With ActiveChart.Parent
    cT = .Top
    cL = .Left
    W = .Width
    H = .Height
    
    MsgBox cT & vbNewLine & cL & vbNewLine & W & vbNewLine & H
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,143
Messages
6,164,178
Members
451,880
Latest member
2da

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