PC Review


Reply
Thread Tools Rate Thread

Chart created with a macro changes location according to screen resolution.

 
 
help_wanted
Guest
Posts: n/a
 
      10th May 2004
I have a macro that creates a chart aligned with a set of cells. I
another user runs this macro with a different screen resolution th
chart covers a different area of the spreadsheet partially covering th
data. Also if the other users have additional or less toolbars, th
location of the chart is offset. Is there a way to assign the locatio
of a chart to cells and not screen location.

Thanks as always

--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
Tushar Mehta
Guest
Posts: n/a
 
      11th May 2004
Use something along the lines of:

Sub testIt()
With ActiveSheet.ChartObjects(1)
.Left = Cells(3, 3).Left
.Top = Cells(3, 3).Top
.Height = 200
.Width = 300
End With
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article <(E-Mail Removed)>, help_wanted
<<(E-Mail Removed)>> says...
> I have a macro that creates a chart aligned with a set of cells. If
> another user runs this macro with a different screen resolution the
> chart covers a different area of the spreadsheet partially covering the
> data. Also if the other users have additional or less toolbars, the
> location of the chart is offset. Is there a way to assign the location
> of a chart to cells and not screen location.
>
> Thanks as always.
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      11th May 2004
You can adjust the code to do this automatically. A recorded macro will
make a chart sheet first, then change its location to a sheet. When it
moves the chart, it sticks it in the middle of the active window (active
pane if you have split panes activated), about half the width and height
of the window's usable height.

Instead of this two step process using Charts.Add, use this:

ActiveSheet.ChartObjects.Add left, top, width, height

where left, top, width, height are dimensions and positions in points.

There's more about VBA and charting here:

http://peltiertech.com/Excel/ChartsH...kChartVBA.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Tushar Mehta wrote:

> Use something along the lines of:
>
> Sub testIt()
> With ActiveSheet.ChartObjects(1)
> .Left = Cells(3, 3).Left
> .Top = Cells(3, 3).Top
> .Height = 200
> .Width = 300
> End With
> End Sub
>


 
Reply With Quote
 
Toby Erkson
Guest
Posts: n/a
 
      11th May 2004
Jon, I found this page of yours more helpful for this type of situation:
http://peltiertech.com/Excel/ChartsH...oveAChart.html

Basically what Tushar posted.
--
Toby Erkson
Oregon, USA
Excel 2002 in Windows XP

"Jon Peltier" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You can adjust the code to do this automatically. A recorded macro will
> make a chart sheet first, then change its location to a sheet. When it
> moves the chart, it sticks it in the middle of the active window (active
> pane if you have split panes activated), about half the width and height
> of the window's usable height.
>
> Instead of this two step process using Charts.Add, use this:
>
> ActiveSheet.ChartObjects.Add left, top, width, height
>
> where left, top, width, height are dimensions and positions in points.
>
> There's more about VBA and charting here:
>
> http://peltiertech.com/Excel/ChartsH...kChartVBA.html
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Peltier Technical Services
> Tutorials and Custom Solutions
> http://PeltierTech.com/
> _______
>
> Tushar Mehta wrote:
>
> > Use something along the lines of:
> >
> > Sub testIt()
> > With ActiveSheet.ChartObjects(1)
> > .Left = Cells(3, 3).Left
> > .Top = Cells(3, 3).Top
> > .Height = 200
> > .Width = 300
> > End With
> > End Sub
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart created on larger screen - Help Les Microsoft Excel Charting 0 6th Aug 2008 07:41 PM
Screen Resolution macro? AK Microsoft Access Macros 0 11th Jun 2007 12:58 AM
Location of Word macro button icons I created? =?Utf-8?B?cGRhbHRvbg==?= Microsoft Word Document Management 3 15th Nov 2006 07:09 AM
How to set chart PlotArea to marry up with fixed rectangle, for any screen resolution Charles Jordan Microsoft Excel Programming 1 2nd Dec 2003 11:33 AM
Execute macro when chart is created Jamie Martin Microsoft Excel Programming 3 11th Oct 2003 03:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:59 PM.