Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I paste a source data reference to a chart using a macro?

I need to be able to draw a new graph as I change the parameters, but that
means that I would have to re-enter the source reference for the X and Y
values. In order to do that I concatenated a string that builds the address,
then I copy it and paste it to the chart's source references. I need to do
that with a macro. When I run the Excel macro utility to recreate all my
steps it inserts a reference that remains permanent. When I run the macro
again it does not paste the new reference but remains with the old one I
inserted previously.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I paste a source data reference to a chart using a macro?

I realized that I need to explain myself better. I first create a string
with the address as follows: =CONCATENATE("=Data!A$4:A$",TEXT(4+H3,"#")), the
I copy and paste special the value to another address.

Below is the macro subroutine to copy the resulting string:
Keyboard Shortcut: Ctrl+w
'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Sheets("S-Curve").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).Values = "=Data!R4C1:R16C1"
ActiveWindow.Visible = False
Sheets("Data").Select
Range("K8").Select
Sheets("S-Curve").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).XValues = "=Data!R4C3:R16C3"
ActiveWindow.Visible = False
Range("C2").Select
End Sub


"Pedro J. Davila" wrote:

I need to be able to draw a new graph as I change the parameters, but that
means that I would have to re-enter the source reference for the X and Y
values. In order to do that I concatenated a string that builds the address,
then I copy it and paste it to the chart's source references. I need to do
that with a macro. When I run the Excel macro utility to recreate all my
steps it inserts a reference that remains permanent. When I run the macro
again it does not paste the new reference but remains with the old one I
inserted previously.

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
Excel changes chart source data. Drops the Filename reference from ybkusz Excel Discussion (Misc queries) 0 February 1st 08 03:14 AM
Macro to shift all source data in a chart by one row or column? Shane Henderson Charts and Charting in Excel 1 November 5th 06 10:33 PM
Paste a chart and get the source data to be from the new worksheet Excelfool Charts and Charting in Excel 5 August 25th 06 05:06 PM
Paste a chart and get the source data to be from the new worksheet Jon Peltier Charts and Charting in Excel 0 August 4th 06 04:36 PM
Using a relative SHEET reference for source data in a chart James Charts and Charting in Excel 6 August 16th 05 05:07 PM


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

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

About Us

"It's about Microsoft Excel"