Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Formula in Chart Title via Macro

Hello all,

Here is what I am trying to do:

chtTitle = "='" & chartDataSheetName & "'!$AG3$3"
.....ChartTitle.Characters.Text = chtTitle

This, of course, does not work because the title ends up being
"='Chart Data'!$AG3$3" (without the quotes) rather than the actual
formula. In searching the group I found a message posted in 1999 with
the following information....

http://groups.google.com/group/micro...a242e5d730580#

****************** BLOCK QUOTE *********************
Is this a flaw in the object model, or am I missing something?


It is a flaw (I would have expected .Text to return the visible text,
and .Caption to return the formula), but you can always fall back to
XLM:

'Activate the chart, then use
sTitle = ExecuteExcel4Macro("GET.FORMULA(""Title"")")

which returns either the text of the title, or its formula in R1C1
style.

Regards

Stephen Bullen
Microsoft MVP - Excel
http://www.BM
SLtd.co.uk

****************** BLOCK QUOTE *********************

However, this has not worked for me either. I could be doing it
incorrectly. How do I identify the formula that it is getting? i.e.
what do I replace "Title" with?

I'm building the entire chart from a macro and I have all the labels
linking to cells so that last minute changes can be made at the whim
of the end user's boss. In other words, I can't just set the title
using formula within the macro. It needs to be in the excel sheet.

I appreciate any help with this.

-Shelton

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Formula in Chart Title via Macro

Hi,

Maybe it simply your range reference $AG3$3 ??

Anyway this works in xl2003.

Activechart.ChartTitle.Text = "=Sheet1!R3C33"

And ExecuteExcel4Macro is for getting the formula used in the chart title
rather than setting it.


Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"shelfish" wrote in message
...
Hello all,

Here is what I am trying to do:

chtTitle = "='" & chartDataSheetName & "'!$AG3$3"
....ChartTitle.Characters.Text = chtTitle

This, of course, does not work because the title ends up being
"='Chart Data'!$AG3$3" (without the quotes) rather than the actual
formula. In searching the group I found a message posted in 1999 with
the following information....

http://groups.google.com/group/micro...a242e5d730580#

****************** BLOCK QUOTE *********************
Is this a flaw in the object model, or am I missing something?


It is a flaw (I would have expected .Text to return the visible text,
and .Caption to return the formula), but you can always fall back to
XLM:

'Activate the chart, then use
sTitle = ExecuteExcel4Macro("GET.FORMULA(""Title"")")

which returns either the text of the title, or its formula in R1C1
style.

Regards

Stephen Bullen
Microsoft MVP - Excel
http://www.BM
SLtd.co.uk

****************** BLOCK QUOTE *********************

However, this has not worked for me either. I could be doing it
incorrectly. How do I identify the formula that it is getting? i.e.
what do I replace "Title" with?

I'm building the entire chart from a macro and I have all the labels
linking to cells so that last minute changes can be made at the whim
of the end user's boss. In other words, I can't just set the title
using formula within the macro. It needs to be in the excel sheet.

I appreciate any help with this.

-Shelton


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Formula in Chart Title via Macro

N'mind!

I was making that way too dificult. Solution:

chtTitle = Range("'" & chartDataSheetName & "'!$AG$3").Value
....ChartTitle.Characters.Text = chtTitle

Feeling a bit dumb right now,
-S.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Formula in Chart Title via Macro

That seems like a convoluted way of getting the text from a cell.

chtTitle = Worksheets(chartDataSheetName).Range("AG3").Value

If you want to link the Title to a cell see Andy's post. To get address in
R1C1 format see Address in help.

Regards,
Peter T


"shelfish" wrote in message
...
N'mind!

I was making that way too dificult. Solution:

chtTitle = Range("'" & chartDataSheetName & "'!$AG$3").Value
...ChartTitle.Characters.Text = chtTitle

Feeling a bit dumb right now,
-S.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Chart title and text formula? Cecilia Charts and Charting in Excel 1 April 16th 10 01:15 PM
Macro for chart title T-Man Charts and Charting in Excel 2 May 30th 08 12:29 PM
Using macro to set chart title with a variable month baldmosher Excel Discussion (Misc queries) 2 November 30th 07 10:18 AM
Formula in Chart Title Phil Hageman Charts and Charting in Excel 9 April 10th 07 06:15 AM
Apologies For No Subject. Chart Title via a Macro Alan Excel Programming 0 August 7th 03 06:26 PM


All times are GMT +1. The time now is 12:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"