Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Need macro to insert chart w/ FIXED size & location

Guys,

after I managed to select the dynamic data range for my chart I am now
inserting a chart via macro...

Sounds simple, but isnt for a newbie ;)

I recorded a macro to move and size the chart, to see which code it
uses:

ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 3").IncrementLeft 37.5
ActiveSheet.Shapes("Chart 3").IncrementTop 24#
ActiveSheet.Shapes("Chart 3").ScaleWidth 1, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 3").ScaleHeight 1, msoFalse,
msoScaleFromTopLeft


It looks like it moves the chart relative to its current position. but
I need to have the chart on FIXED points. It will be oriented along
cells (if that makes it easier) it will always be in the same spot and
although the amount of data varies the size of the chart must always be
the same...

How can i accomplish this? I was thinking there must be a command that
tells Excel the position of the corners or one corner and length and
width...

Any help aprreciated :)

Matt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need macro to insert chart w/ FIXED size & location

Dim rng as Range
set rng = Range("B9").Resize(3,5)
With ActiveSheet.ChartObjects(1)
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width
.Height = rng.Height
End With

--
Regards,


"Matt" wrote in message
oups.com...
Guys,

after I managed to select the dynamic data range for my chart I am now
inserting a chart via macro...

Sounds simple, but isnt for a newbie ;)

I recorded a macro to move and size the chart, to see which code it
uses:

ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 3").IncrementLeft 37.5
ActiveSheet.Shapes("Chart 3").IncrementTop 24#
ActiveSheet.Shapes("Chart 3").ScaleWidth 1, msoFalse,
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 3").ScaleHeight 1, msoFalse,
msoScaleFromTopLeft


It looks like it moves the chart relative to its current position. but
I need to have the chart on FIXED points. It will be oriented along
cells (if that makes it easier) it will always be in the same spot and
although the amount of data varies the size of the chart must always be
the same...

How can i accomplish this? I was thinking there must be a command that
tells Excel the position of the corners or one corner and length and
width...

Any help aprreciated :)

Matt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Need macro to insert chart w/ FIXED size & location

Thanks Tom ! Havent had a chance to test it but it looks like just what
i need :)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixed Chart Location Dave_AD Charts and Charting in Excel 2 December 26th 06 03:57 PM
macro for fixed color lines in line chart based on series name sm Charts and Charting in Excel 1 November 13th 06 09:31 AM
How do I get a formula to use data from a fixed location(NOT vicev Pete w Excel Discussion (Misc queries) 6 May 3rd 05 11:48 PM
Size and location of an embedded chart Raul[_4_] Excel Programming 2 July 3rd 04 06:04 PM
Size and location of chart Mark Anderson Excel Programming 1 July 14th 03 09:48 PM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"