Extract the value from a cell, and add it to a chart title

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
(e-mail address removed)
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
 
Art,
Try
BarnName = ActiveChart.ChartTitle.Text & " " & _
sheets("Data").cells(6, 1).value
ActiveChart.ChartTitle.Text = BarnName
Cecil

Art said:
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.
 
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:=True)

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/
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top