Thread
:
Assign charts names in VBA?
View Single Post
#
2
Posted to microsoft.public.excel.misc
Don Guillett
Posts: n/a
Assign charts names in VBA?
the macro recorder is your friend
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 5/10/2006 by Don Guillett
'
'
ActiveSheet.Shapes("Chart 2").Select
Selection.Name = "namedchart"
End Sub
shorten to
sheets("sheet2").Shapes("Chart 2").Name = "namedchart"
--
Don Guillett
SalesAid Software
"PaulW" wrote in message
...
Two charts, one on "Options" page, one on "Data" page. Make a simple macro
that switches the two round.
Recorded a macro, and when I tried to run it I got an error.
ActiveSheet.ChartObjects("Chart 51").Activate
ActiveChart.ChartArea.Select
ActiveChart.Location Whe=xlLocationAsObject, Name:="Data"
Then Chart 24 to "Options". Also recorded the bit where they switch back.
But Chart 24 is now Chart 25, and Chart 51 is now Chart 54. The numbers
seem
to go up each time something is done with a chart... As such, when I try
and
run the macro again the charts have different numbers and it fails.
Can you assign a name to a chart to provent this?
Reply With Quote