Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA: Problem with copying an embedded chart from one worksheet to another

I want to copy an embedded chart from one worksheet to another workshee
in a different workbook and maintain the pasted chart focus. My cod
snipit:

'The chart I am copying from is called Total Amounts
ActiveChart.Parent.Name = "Total Amounts"
ActiveChart.ChartArea.Copy 'Copy the chart

'I delete any existing charts on the destination worksheet
Dim nChart As Integer

For nChart = 1 T
Workbooks("TotalsBook").Worksheets("A-F").ChartObjects.Count
If Workbooks("TotalsBook").Worksheets("A-F").ChartObjects(nChart).Nam
= "Total Amounts" Then
Workbooks("TotalsBook").Worksheets("A-F").ChartObjects(nChart).Delete
Exit For
End If
Next nChart

'I paste the chart on the new worksheet
Workbooks("TotalsBook").Worksheets("A-F").Paste

The problem is, the chart name for the pasted chart is not Tota
Amounts but the default chart name. I want to be able to select th
chart so I can reposition and resize etc, but I can't reference it. Th
destination workbook Workbooks("TotalsBook").Worksheets("A-F") contain
many charts, so I can't just select chart 1. Can I copy the sourc
chart and paste it in the new workbook and maintain the chart name?

Thank you in advance for any input given on this topic

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Excel VBA: Problem with copying an embedded chart from one worksheetto another

Sub test()
ActiveChart.Parent.Name = "Total Amounts"
ActiveChart.ChartArea.Copy 'Copy the chart
cur_cnt = Sheets(2).ChartObjects.Count 'count existing charts in sheet
where you want to paste
Sheets(2).Paste ' paste
Sheets(2).ChartObjects(cur_cnt + 1).Select ' select the newly added chart
ActiveChart.Parent.Name = "Total Amounts" 'rename or do anyother thing :)
End Sub


Flystar < wrote:
I want to copy an embedded chart from one worksheet to another worksheet
in a different workbook and maintain the pasted chart focus. My code
snipit:

'The chart I am copying from is called Total Amounts
ActiveChart.Parent.Name = "Total Amounts"
ActiveChart.ChartArea.Copy 'Copy the chart

'I delete any existing charts on the destination worksheet
Dim nChart As Integer

For nChart = 1 To
Workbooks("TotalsBook").Worksheets("A-F").ChartObjects.Count
If Workbooks("TotalsBook").Worksheets("A-F").ChartObjects(nChart).Name
= "Total Amounts" Then
Workbooks("TotalsBook").Worksheets("A-F").ChartObjects(nChart).Delete
Exit For
End If
Next nChart

'I paste the chart on the new worksheet
Workbooks("TotalsBook").Worksheets("A-F").Paste

The problem is, the chart name for the pasted chart is not Total
Amounts but the default chart name. I want to be able to select the
chart so I can reposition and resize etc, but I can't reference it. The
destination workbook Workbooks("TotalsBook").Worksheets("A-F") contains
many charts, so I can't just select chart 1. Can I copy the source
chart and paste it in the new workbook and maintain the chart name?

Thank you in advance for any input given on this topic.


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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA: Problem with copying an embedded chart from one worksheet

So simple, but so effective. Cheers! ;

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

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
Problem in updating the Powerpoint Embedded Chart with Excel figur Vinod Charts and Charting in Excel 0 May 4th 07 02:19 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Discussion (Misc queries) 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Worksheet Functions 2 August 24th 06 05:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet jeftiong New Users to Excel 0 August 23rd 06 01:50 PM


All times are GMT +1. The time now is 07:24 AM.

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"