ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to link a chart title to a worksheet cell c#? (https://www.excelbanter.com/excel-programming/362712-how-link-chart-title-worksheet-cell-c.html)

Frank M. Walter

How to link a chart title to a worksheet cell c#?
 
Hello,

it is possible to link a chart title to a cell via vba macro:

Sub Makro2()
ActiveSheet.ChartObjects("Diagramm 1").Activate
ActiveChart.ChartTitle.Select
Selection.Text = "=Tabelle1!R1C3"
End Sub

How do I do this in c#?

Just puting this code
string newTitle = "=Tabelle1!R1C3"

chart.ChartTitle.Text = newTitle.ToString() ;

....gets only the content of existing cell and puts ot to chart title.

The formula is not getting.



Thanks
Frank



Leith Ross[_568_]

How to link a chart title to a worksheet cell c#?
 

Hello Frank,

Change your code to the following...

Sub Makro2()
ActiveSheet.ChartObjects("Diagramm 1").Activate
ActiveChart.ChartTitle.Text = Evaluate("=Tabelle1!R1C3")
End Sub

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=54648


Frank M. Walter

How to link a chart title to a worksheet cell c#?
 
Hello Leith,
your solution does work as makro.

I need c# solution.
How does your function will be written in c# ?

Thanks
Frank



"Leith Ross"
schrieb im Newsbeitrag
...

Hello Frank,

Change your code to the following...

Sub Makro2()
ActiveSheet.ChartObjects("Diagramm 1").Activate
ActiveChart.ChartTitle.Text = Evaluate("=Tabelle1!R1C3")
End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=546485





All times are GMT +1. The time now is 04:02 AM.

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