PC Review


Reply
Thread Tools Rate Thread

Controlling the number excel gives to charts

 
 
GC
Guest
Posts: n/a
 
      11th Dec 2009
Hello,

When creating charts in workbooks, excel will assign a number to it. So if I
have 10 charts through out my project I should have charts numbered 1 thru
10. But if I delete a few and create a few more, the numbering will no
longer be sequential. When automating certain processes it becomes a little
difficult when charts have been numbered in this way.

example.

If I wanted to perform some operation on 4 of the 10 charts within a FOR
NEXT loop, it would be difficult if the charts were numbered 2,4,5 and10.

For Var = 1 to 4

ActiveSheet.ChartObjects("Chart "& Var).Activate

blah

blah

blah

Next



How does one deal with this dilemma? I have looked (seems like everywhere)
for a place where I can re-number the charts. Or are there other options?



Thanks,

Gerry


 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      11th Dec 2009
Try...

Sub Macro1()
Dim objchart As ChartObject
For Each objchart In ActiveSheet.ChartObjects

'MsgBox objchart.Name
'Use a Select CAse statement or IF condition to filter the 4 charts

Next
End Sub

--
Jacob


"GC" wrote:

> Hello,
>
> When creating charts in workbooks, excel will assign a number to it. So if I
> have 10 charts through out my project I should have charts numbered 1 thru
> 10. But if I delete a few and create a few more, the numbering will no
> longer be sequential. When automating certain processes it becomes a little
> difficult when charts have been numbered in this way.
>
> example.
>
> If I wanted to perform some operation on 4 of the 10 charts within a FOR
> NEXT loop, it would be difficult if the charts were numbered 2,4,5 and10.
>
> For Var = 1 to 4
>
> ActiveSheet.ChartObjects("Chart "& Var).Activate
>
> blah
>
> blah
>
> blah
>
> Next
>
>
>
> How does one deal with this dilemma? I have looked (seems like everywhere)
> for a place where I can re-number the charts. Or are there other options?
>
>
>
> Thanks,
>
> Gerry
>
>
> .
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum number of charts--Excel 2007? Andy Microsoft Excel Misc 1 20th Oct 2009 04:16 PM
Is it possible to create a number of charts in a single sheet in an excel? i.sobha@gmail.com Microsoft Access 1 27th Apr 2007 06:31 AM
Controlling line colors/styles in excel charts =?Utf-8?B?UmljaA==?= Microsoft Excel Charting 2 8th Jul 2006 02:16 PM
Creating a macro to copy a number of charts from Excel to PPT =?Utf-8?B?QnJpYW4=?= Microsoft Excel Programming 0 16th Dec 2005 04:53 PM
Programatically controlling scales on charts Nick H Microsoft Access Form Coding 0 28th Nov 2003 05:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 AM.