Hey,
I have a function, that one of the members in this forum wrote.
that changes the title of a chart according to the text that is written in a specific cell.
I added this code to a module:
Function A_ChangeChartTitle(CNameD, titleA)
ActiveSheet.ChartObjects(CNameD).Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Text = titleA
End With
A_ChangeChartTitle = "Function - Chart Title"
End Function
and I was able to use it in the excel- worked fine.
I tryed to record it , but only once I succeeded in recording it and I got this code:
Range("G5").Select
ActiveCell.FormulaR1C1 = "New Title"
Range("G3").Select
ActiveCell.FormulaR1C1 = "=A_ChangeChartTitle()"
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Select
Range("G3").Select
ActiveCell.FormulaR1C1 = "=A_ChangeChartTitle(""Chart 1,G5"")"
when I tryed to insert it to an existing code I got an error that the value was'nt found.
Later on I tryed to record it again but it wasn't successfull- there was no code similar to the one I got when I first recorded.
another thing I noticed is : when I used the function A_ChangeChartTitle stright forward in the excel file:the code in the "insert function" in the excel looked like this:
=A_ChangeChartTitle("Chart 1",F5)
but in the code I got while recording- the same one that gave the error - the code looked like that:
=A_ChangeChartTitle("Chart 1,G5")
I tryed to change the inverted commas but I got a sintax error.
Hope you can help me,
thanks
Bookmarks