LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default using a macro to edit the data range of a chart

You don't need a macro to do this. You can use a dynamic defined name for
the X and Y data for each series, and reference these names in the chart
SERIES formula.

Dynamic Charts:
http://peltiertech.com/WordPress/200...ynamic-charts/
http://peltiertech.com/Excel/Charts/Dynamics.html

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


"Joel" wrote in message
...
Sub getchartrange()

'get chart name
For Each shp In ActiveSheet.Shapes
If shp.Type = msoChart Then
chrtname = shp.Name
MsgBox ("Chart Name = " & chrtname)
Exit For
End If
Next shp
Set chrt = ActiveSheet.ChartObjects(chrtname)
chrt.Activate
ActiveChart.SetSourceData _
Source:=Sheets("Sheet1").Range("A1:B3"), _
PlotBy:=xlRows

End Sub

"Monkey-See, Monkey-Do" wrote:

Does anyone know how to write a macro in order to select the data range
of a
chart?

The reason is that I have a macro which inserts a line and then copies
data
into that new line from another worksheet. Doing this adjusts the data
range
of the chart which already exists in the worksheet and means that the new
line is ignored....

I tried to record a macro to do this but it falls over after clicking
select
data.



 
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
can i edit only a selected range of data in an excel chart? aarho Charts and Charting in Excel 1 December 2nd 09 09:27 PM
macro for chart data range extension mohavv Excel Discussion (Misc queries) 0 November 10th 09 08:24 PM
Create macro to calculate data range for a running chart James Lucero Excel Worksheet Functions 1 April 29th 08 04:27 PM
Edit Chart Macro Help - Skip ActiveChart Selection if no data [email protected] Excel Programming 1 April 6th 07 10:30 PM
Macro to edit Range Name [email protected] Excel Programming 4 January 6th 06 05:21 PM


All times are GMT +1. The time now is 06:11 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"