V
vicky
i have 5 charts in a sheet . i want to access this charts using index
number . need vba code to give desire index numbers to charts i.e i
want to programmitically give index number to all charts . i want to
assign the mentioned index numbers to those charts
charts name index number
charts 1 1
charts 2 2
charts 3 3
i have code which renames the charts present in the worksheet but the
index number remains 1 for all charts . say if have 3 charts in a
sheet i have to execute this below program thrice inorder to have
index number 1 , 2 and 3 for the charts . Before running this program
all the 3 charts had same index number and same chart name
Sub Renamecharts()
Dim chtobj As ChartObject
Dim Msg As String
Dim n As Integer
n = ActiveSheet.ChartObjects.Count
Msg = "Chart List for Sheet " & vbTab & ActiveSheet.Name & vbTab & "No
charts = " & n & vbCrLf & vbCrLf
Msg = Msg & "Name " & vbTab & vbTab & "Index" & vbCrLf
i = 0
For Each chtobj In ActiveSheet.ChartObjects
i = i + 1
chtobj.Activate
chtobj.Name = "Charts" & i
'chtobj.Index= i ' '''''''''' i want to do something like this
'''''''''''''''''''''''
Debug.Print chtobj.Name
Msg = Msg & chtobj.Name & vbTab & vbTab & chtobj.Index & vbCrLf
Next chtobj
out = MsgBox(Msg, , "Chart List")
End Sub
number . need vba code to give desire index numbers to charts i.e i
want to programmitically give index number to all charts . i want to
assign the mentioned index numbers to those charts
charts name index number
charts 1 1
charts 2 2
charts 3 3
i have code which renames the charts present in the worksheet but the
index number remains 1 for all charts . say if have 3 charts in a
sheet i have to execute this below program thrice inorder to have
index number 1 , 2 and 3 for the charts . Before running this program
all the 3 charts had same index number and same chart name
Sub Renamecharts()
Dim chtobj As ChartObject
Dim Msg As String
Dim n As Integer
n = ActiveSheet.ChartObjects.Count
Msg = "Chart List for Sheet " & vbTab & ActiveSheet.Name & vbTab & "No
charts = " & n & vbCrLf & vbCrLf
Msg = Msg & "Name " & vbTab & vbTab & "Index" & vbCrLf
i = 0
For Each chtobj In ActiveSheet.ChartObjects
i = i + 1
chtobj.Activate
chtobj.Name = "Charts" & i
'chtobj.Index= i ' '''''''''' i want to do something like this
'''''''''''''''''''''''
Debug.Print chtobj.Name
Msg = Msg & chtobj.Name & vbTab & vbTab & chtobj.Index & vbCrLf
Next chtobj
out = MsgBox(Msg, , "Chart List")
End Sub