Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 22
Default Identifying copied charts on a worksheet

I have a template.xls file that contains one "form" (actually a range, A1:
AE28, formatted for my data) for displaying store data. This "form" includes
8 small charts that have datasources on the same range as the charts. I can
easily determine the datasource range for each of the 8 charts, but am having
difficulty assigning the datasource to the correct chart due to the
difficulty in identifying, from my code, which chart goes with which
datasource.

This is only the beginning of the problem. What my Access code does, is it
opens the "template.xls" and saves it as "current.xls". Then I copy the
"form", including the charts, and paste it below the original. I then
populate the original, at the top of the worksheet, with the store data. Then
I copy the empty copy below the form I've just populated, paste it again
under the empty form I just copied, and proceed to populate the second form.
Then I copy the 3rd form and paste it underneath again, and so on, and so on,
until all 900+ stores have forms, each containing 8 small charts, with source
data in ranges to their right.

I hope this makes sense to someone who can give me some guidance. I've
learned that the sourcedata is a property of the chart, which is a property
of the chartobject in the chartobjects collection of the worksheet, but have
not been able to concisely identify the location of each chart so I can
supply the corresponding source data ranges. As it is, when I copy the charts,

they retain their original source data at the top of the worksheet. I need to
change that to reflect the ranges to the right of the charts as I copy and
paste them in the worksheet.

Here's a code sample I tried to use to rename the chartobjects, but I don't
know if the chartobjects are listed in the collection in the same order they
appear on the worksheet:

Function RenameCharts(x As Integer) As String
'renames charts to reflect actual # in worksheet
Dim CO As ChartObject
Dim n As Integer

For Each CO In Sheets("StoreReports").ChartObjects
n = n + 1
CO.Name = "ChObj " & n
Next CO

End Function

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...chart/200802/1

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Identifying copied charts on a worksheet

Could you use something like this, collect the positions as distances from
the top of the sheet, and then process the charts in order of their
position:

For i = 1 to ActiveSheet.ChartObjects.Count
Distance(i) = ActiveSheet.ChartObjects(i).Top
Next

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


"ragtopcaddy via OfficeKB.com" <u9289@uwe wrote in message
news:8020d61370a64@uwe...
I have a template.xls file that contains one "form" (actually a range, A1:
AE28, formatted for my data) for displaying store data. This "form"
includes
8 small charts that have datasources on the same range as the charts. I
can
easily determine the datasource range for each of the 8 charts, but am
having
difficulty assigning the datasource to the correct chart due to the
difficulty in identifying, from my code, which chart goes with which
datasource.

This is only the beginning of the problem. What my Access code does, is it
opens the "template.xls" and saves it as "current.xls". Then I copy the
"form", including the charts, and paste it below the original. I then
populate the original, at the top of the worksheet, with the store data.
Then
I copy the empty copy below the form I've just populated, paste it again
under the empty form I just copied, and proceed to populate the second
form.
Then I copy the 3rd form and paste it underneath again, and so on, and so
on,
until all 900+ stores have forms, each containing 8 small charts, with
source
data in ranges to their right.

I hope this makes sense to someone who can give me some guidance. I've
learned that the sourcedata is a property of the chart, which is a
property
of the chartobject in the chartobjects collection of the worksheet, but
have
not been able to concisely identify the location of each chart so I can
supply the corresponding source data ranges. As it is, when I copy the
charts,

they retain their original source data at the top of the worksheet. I need
to
change that to reflect the ranges to the right of the charts as I copy and
paste them in the worksheet.

Here's a code sample I tried to use to rename the chartobjects, but I
don't
know if the chartobjects are listed in the collection in the same order
they
appear on the worksheet:

Function RenameCharts(x As Integer) As String
'renames charts to reflect actual # in worksheet
Dim CO As ChartObject
Dim n As Integer

For Each CO In Sheets("StoreReports").ChartObjects
n = n + 1
CO.Name = "ChObj " & n
Next CO

End Function

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...chart/200802/1



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
My charts are copied into Word in black and white instead of colou Feroni Excel Discussion (Misc queries) 3 May 21st 23 03:46 AM
Named-range source-data for pie charts on copied worksheets [email protected] Charts and Charting in Excel 4 March 19th 07 05:50 AM
Identifying/Eliminating Worksheet References timsantiago Excel Discussion (Misc queries) 3 November 9th 05 04:32 PM
Copied Charts Aurora Charts and Charting in Excel 1 March 11th 05 02:06 AM
problems with charts copied into Word 2000 JulieD Excel Discussion (Misc queries) 0 December 16th 04 04:12 PM


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