ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems changing Embedded Chart Name (https://www.excelbanter.com/excel-programming/342740-problems-changing-embedded-chart-name.html)

[email protected]

Problems changing Embedded Chart Name
 
I've been having problems naming some charts, whose name I will need
later in my macro.
Here is my code:

Sub IPChart()
Charts.Add
With ActiveChart
.ChartType = xlColumnStacked
.SetSourceData Source:=Sheets("Recortadores").Range("B37:L94"),
PlotBy:=xlColumns
.Location xlLocationAsObject, name:="Recortadores"
End With

'To make sure there is a name, I always get "Recortadores Chart x"
MsgBox ActiveChart.name

ActiveChart.name = "HourChart"
End Sub

Among other things, I want to know if a given chart exists like this:

Function ChartExists(hoja As String, name As String) As Boolean
Dim C As ChartObject
On Error Resume Next
Set C = Sheets(hoja).ChartObjects(name)
If Err = 0 Then
ChartExists = True
Else
ChartExists = False
End If
End Function


Anyone has any ideas???



All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com