|
-
Mar 20th, 2003, 03:22 AM
#1
-
Mar 20th, 2003, 04:25 AM
#2
Hi Opus, you could check this by looping through each chart in the collection & evaluating the name there ...
VB Code:
Private Sub CommandButton1_Click()
Dim intLoopCounter As Integer
For intLoopCounter = 1 To Workbooks(1).Charts.Count
If (Charts(intLoopCounter).Name = "Chart1") Then
Charts(intLoopCounter).Name = "Cartman"
End If
Next
End Sub
-
Mar 20th, 2003, 04:29 AM
#3
Or you can use this method of doing the same thing - I've just checked this out & certainly in Excel 2000, the argument you pass to the charts collection can either be a string representing the name of a specific chart, or it can be a number index of the chart within the collection...
VB Code:
Private Sub CommandButton1_Click()
Workbooks(1).Charts("Chart1").Name = "Cartman"
End Sub
-
Mar 20th, 2003, 04:34 AM
#4
Finally, to set this property via code when you create the cart, you can use this one:
VB Code:
Private Sub CommandButton1_Click()
Workbooks(1).Charts.Add
With ActiveChart
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Sheet1").Range("A1:A5"), _
PlotBy:=xlColumns
.HasLegend = True
.Legend.Select
.Legend.Position = xlRight
[b].Name = "Cartman"[/b]
End With
End Sub
Hope this helps!
-
Mar 20th, 2003, 05:26 AM
#5
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|