ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract the value from a cell, and add it to a chart title (https://www.excelbanter.com/excel-programming/296816-extract-value-cell-add-chart-title.html)

art

Extract the value from a cell, and add it to a chart title
 
H
I'm trying to take the value from a cell on a different worksheet, and add it to some text for a chart title
I presently have
Dim BarnName as Strin
BarnName = ActiveChart.ChartTitle = "=data!R6c1
ActiveChart.ChartTitle.Characters.Text = BarnNam

I know the second line isn't correct, but I'm not sure how to write it

TI
Art

Edwin Tam[_4_]

Extract the value from a cell, and add it to a chart title
 
The macro should look like this

Sub Assign_Chart_Title(
ActiveChart.ChartTitle.Characters.Text = Worksheets("data").Range("A7").Valu
End Su

To use the macro, select the chart, and run the macro

Regards
Edwin Ta

http://www.vonixx.co


----- Art wrote: ----

H
I'm trying to take the value from a cell on a different worksheet, and add it to some text for a chart title
I presently have
Dim BarnName as Strin
BarnName = ActiveChart.ChartTitle = "=data!R6c1
ActiveChart.ChartTitle.Characters.Text = BarnNam

I know the second line isn't correct, but I'm not sure how to write it

TI
Art

Cecilkumara Fernando[_2_]

Extract the value from a cell, and add it to a chart title
 
Art,
Try
BarnName = ActiveChart.ChartTitle.Text & " " & _
sheets("Data").cells(6, 1).value
ActiveChart.ChartTitle.Text = BarnName
Cecil

"Art" wrote in message
...
Hi
I'm trying to take the value from a cell on a different worksheet, and add

it to some text for a chart title.
I presently have:
Dim BarnName as String
BarnName = ActiveChart.ChartTitle = "=data!R6c1"
ActiveChart.ChartTitle.Characters.Text = BarnName

I know the second line isn't correct, but I'm not sure how to write it.

TIA
Art




Jon Peltier[_7_]

Extract the value from a cell, and add it to a chart title
 
If you want this to be dynamic, put the formula with the added text into
a cell, and link the title to the cell.

C1 has text, C2 has a value, put this into C3:

=C1&TEXT(C2,"0.00")

Use some appropriate number format, or you may get something unexpected.

Now select the chart title, press the = key, and select C3 with the mouse.

To link the title to the cell in VBA, use:

ActiveChart.ChartTitle.Text = _
"=" Sheets("Data").Cells(3,3).AddressR1C1(External:=Tr ue)

You need to specify this address in RC notation, and External:=True
includes the qualified sheet name.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Cecilkumara Fernando wrote:

Art,
Try
BarnName = ActiveChart.ChartTitle.Text & " " & _
sheets("Data").cells(6, 1).value
ActiveChart.ChartTitle.Text = BarnName
Cecil

"Art" wrote in message
...

Hi
I'm trying to take the value from a cell on a different worksheet, and add


it to some text for a chart title.

I presently have:
Dim BarnName as String
BarnName = ActiveChart.ChartTitle = "=data!R6c1"
ActiveChart.ChartTitle.Characters.Text = BarnName

I know the second line isn't correct, but I'm not sure how to write it.

TIA
Art







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

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