Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default populate chart array

I want to fill an array with the charts on a worksheet so that I can loop through each.
i.e
chartArray = Array(Chart1, Cahart2

For each a in chartArra
'do somethin
next

This is ok, however I don't know the chart names and they will change from time to time

So, how do I populate the array with the chartobjects names on the activesheet

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default populate chart array

John

You don't need to put them into an array. Try the
following

For Each ch In ActiveSheet.ChartObjects
MsgBox ch.Name
Next ch

Tony
-----Original Message-----
I want to fill an array with the charts on a worksheet so

that I can loop through each.
i.e.
chartArray = Array(Chart1, Cahart2)

For each a in chartArray
'do something
next a

This is ok, however I don't know the chart names and they

will change from time to time.

So, how do I populate the array with the chartobjects

names on the activesheet?

John
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default populate chart array

the chartobjects collection finctions like an array, so often you don'
need to create an array, eg:
Sub show_charts()
For Each CC In ActiveSheet.ChartObjects
MsgBox CC.Name
Next
End Sub


if you do need to create an array, try this:
Sub create_chart_array()
Dim chartarray()
n = 0
For Each CC In ActiveSheet.ChartObjects
ReDim Preserve chartarray(n)
chartarray(n) = ActiveSheet.ChartObjects(n + 1).Name
n = 1 + n
Next
End Su

--
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
Array to Populate ListBox Problem pallaver Excel Discussion (Misc queries) 1 July 25th 08 08:50 AM
Populate an array that is a subset of a larger array? Jeff Excel Worksheet Functions 1 September 25th 07 12:51 AM
How do I Auto Populate a cell with a chart based on a value Bryan[_2_] Excel Worksheet Functions 0 March 24th 07 01:03 AM
Need to randomly populate a 10x10 array of cells with 100 names - 5 people listed 20 times each... Kevin Lyons[_2_] Excel Programming 3 February 8th 04 08:28 PM
Populate array Beto[_3_] Excel Programming 6 December 30th 03 09:53 PM


All times are GMT +1. The time now is 10:51 AM.

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"