Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone tell me how to set an array of charts within Visual Basic?
Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you are dealing with objects such as charts you are better off witha
collection than an array... Try something like this... Sub test() Dim colCharts As Collection Dim cht As ChartObject Set colCharts = New Collection colCharts.Add Sheet1.ChartObjects(1), "Chart1" colCharts.Add Sheet2.ChartObjects(1), "Chart2" For Each cht In colCharts MsgBox cht.Name Next cht End Sub -- HTH... Jim Thomlinson "CloudDoctor" wrote: Can anyone tell me how to set an array of charts within Visual Basic? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've used arrays. It depends why the user needs an array or collection of
charts. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Jim Thomlinson" wrote in message ... When you are dealing with objects such as charts you are better off witha collection than an array... Try something like this... Sub test() Dim colCharts As Collection Dim cht As ChartObject Set colCharts = New Collection colCharts.Add Sheet1.ChartObjects(1), "Chart1" colCharts.Add Sheet2.ChartObjects(1), "Chart2" For Each cht In colCharts MsgBox cht.Name Next cht End Sub -- HTH... Jim Thomlinson "CloudDoctor" wrote: Can anyone tell me how to set an array of charts within Visual Basic? Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Being that you are the charts guru I will defer to your answer. Normally when
I describe storing objects in a collection I premise the answer with "usually" a collection is better. That being said when would you prefer an array? While I recognize that you can do it I am hard pressed to see an advantage. -- HTH... Jim Thomlinson "Jon Peltier" wrote: I've used arrays. It depends why the user needs an array or collection of charts. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Jim Thomlinson" wrote in message ... When you are dealing with objects such as charts you are better off witha collection than an array... Try something like this... Sub test() Dim colCharts As Collection Dim cht As ChartObject Set colCharts = New Collection colCharts.Add Sheet1.ChartObjects(1), "Chart1" colCharts.Add Sheet2.ChartObjects(1), "Chart2" For Each cht In colCharts MsgBox cht.Name Next cht End Sub -- HTH... Jim Thomlinson "CloudDoctor" wrote: Can anyone tell me how to set an array of charts within Visual Basic? Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't know if there's an advantage of arrays over collections. I started
out using arrays before I understood collections, and I've never converted the old code. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Jim Thomlinson" wrote in message ... Being that you are the charts guru I will defer to your answer. Normally when I describe storing objects in a collection I premise the answer with "usually" a collection is better. That being said when would you prefer an array? While I recognize that you can do it I am hard pressed to see an advantage. -- HTH... Jim Thomlinson "Jon Peltier" wrote: I've used arrays. It depends why the user needs an array or collection of charts. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Jim Thomlinson" wrote in message ... When you are dealing with objects such as charts you are better off witha collection than an array... Try something like this... Sub test() Dim colCharts As Collection Dim cht As ChartObject Set colCharts = New Collection colCharts.Add Sheet1.ChartObjects(1), "Chart1" colCharts.Add Sheet2.ChartObjects(1), "Chart2" For Each cht In colCharts MsgBox cht.Name Next cht End Sub -- HTH... Jim Thomlinson "CloudDoctor" wrote: Can anyone tell me how to set an array of charts within Visual Basic? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Chart Moving | Excel Programming | |||
extending a chart with visual basic | Excel Programming | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
visual basic & chart data labels | Excel Programming | |||
How do I use an array function in Visual basic .NET? | Excel Programming |