PDA

View Full Version : Changing chart titles using VBA



colene
04-09-2008, 02:31 AM
Basically i want multiline chart title in my graph which will change dynamically.
based on the values in cell J10 and J12.
I want the contents to be there in chart

I tried these ways but did not work ...
first try:
mytitle= "=Tabelle1!R22C1"
mysubtitle = mytitle & Chr(10) & "nach MittelEinsatz"
chtChart.ChartTitle.Text = mysubtitle

here i get the value of mytitle as text ...

but when i do the same

chtChart.ChartTitle.Text = "=Tabelle1!R22C1".I get the content of row 22 and column 1 but not a multiline title
second try

I had two cells J10 and J12 named title1 and title2 on Sheet1mytitle = Range("Sheet1!title1") & Chr(10) & Range("Sheet1!title2")
chtChart.ChartTitle.Text = mytitle

I get an error in the line 1.

Can anyone suggest me ..

colene
04-09-2008, 03:52 AM
Solution to the problem

chtChart.ChartTitle.Text = Sheets("Tabelle1").Range("J7").Value & Chr(10) & Sheets("Tabelle1").Range("J9").Value

colene
04-10-2008, 10:40 PM
Thanks a lot it works ...