PC Review


Reply
Thread Tools Rate Thread

Charttiltle as function

 
 
Trond
Guest
Posts: n/a
 
      20th Nov 2009
I have programmed a macro that makes a pivottable and a pivotdiagram. In this
diagram I have a charttitle that I want to be equal to the content of one
cell (D2).
So if the content of the cell changes, I want the Charttitle also to change.

Manually I can do this by selecting the charttitle and use the function
(=D2) on the top of the excel-sheet. But this will not work when I try the
recorder.

Can anyone help?
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      20th Nov 2009
Are you running the macro each time the chart title changes?

Barb Reinhardt



"Trond" wrote:

> I have programmed a macro that makes a pivottable and a pivotdiagram. In this
> diagram I have a charttitle that I want to be equal to the content of one
> cell (D2).
> So if the content of the cell changes, I want the Charttitle also to change.
>
> Manually I can do this by selecting the charttitle and use the function
> (=D2) on the top of the excel-sheet. But this will not work when I try the
> recorder.
>
> Can anyone help?

 
Reply With Quote
 
Trond
Guest
Posts: n/a
 
      20th Nov 2009
No. I produce the table and diagram once. As I change the pagefield in the
pivot, I also want the title to change according to it.



"Barb Reinhardt" wrote:

> Are you running the macro each time the chart title changes?
>
> Barb Reinhardt
>
>
>
> "Trond" wrote:
>
> > I have programmed a macro that makes a pivottable and a pivotdiagram. In this
> > diagram I have a charttitle that I want to be equal to the content of one
> > cell (D2).
> > So if the content of the cell changes, I want the Charttitle also to change.
> >
> > Manually I can do this by selecting the charttitle and use the function
> > (=D2) on the top of the excel-sheet. But this will not work when I try the
> > recorder.
> >
> > Can anyone help?

 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      20th Nov 2009
Trond,

You need to activate the chart and set the link as an R1C1 style formula in Text

ActiveSheet.ChartObjects("Chart 3").Activate 'or other code, depending on.....
ActiveChart.ChartTitle.Text = "=Sheet1!R2C4"


HTH,
Bernie
MS Excel MVP


"Trond" <(E-Mail Removed)> wrote in message
news:7DAEA858-4598-4D74-9696-(E-Mail Removed)...
> No. I produce the table and diagram once. As I change the pagefield in the
> pivot, I also want the title to change according to it.
>
>
>
> "Barb Reinhardt" wrote:
>
>> Are you running the macro each time the chart title changes?
>>
>> Barb Reinhardt
>>
>>
>>
>> "Trond" wrote:
>>
>> > I have programmed a macro that makes a pivottable and a pivotdiagram. In this
>> > diagram I have a charttitle that I want to be equal to the content of one
>> > cell (D2).
>> > So if the content of the cell changes, I want the Charttitle also to change.
>> >
>> > Manually I can do this by selecting the charttitle and use the function
>> > (=D2) on the top of the excel-sheet. But this will not work when I try the
>> > recorder.
>> >
>> > Can anyone help?



 
Reply With Quote
 
john
Guest
Posts: n/a
 
      20th Nov 2009
see if this helps:

With ActiveSheet.ChartObjects(1).Chart

.HasTitle = True
.ChartTitle.Text = Range("D2").Value

End With
--
jb


"Trond" wrote:

> I have programmed a macro that makes a pivottable and a pivotdiagram. In this
> diagram I have a charttitle that I want to be equal to the content of one
> cell (D2).
> So if the content of the cell changes, I want the Charttitle also to change.
>
> Manually I can do this by selecting the charttitle and use the function
> (=D2) on the top of the excel-sheet. But this will not work when I try the
> recorder.
>
> Can anyone help?

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      20th Nov 2009
I'm not sure if your really mean a ChartTitle (on a diagram?) but if you do
try something like this

Sub test()
Dim sLink As String
Dim rCell As Range
Dim cht As Chart
Dim ct As ChartTitle

Set rCell = ActiveSheet.Range("D2")
sLink = rCell.Address(, , xlR1C1, True)

Set cht = ActiveSheet.ChartObjects(1).Chart
Set ct = cht.ChartTitle

ct.Text = "=" & sLink

End Sub

Regards,
Peter T

"Trond" <(E-Mail Removed)> wrote in message
newsFC0D7DF-B92F-4853-90C1-(E-Mail Removed)...
>I have programmed a macro that makes a pivottable and a pivotdiagram. In
>this
> diagram I have a charttitle that I want to be equal to the content of one
> cell (D2).
> So if the content of the cell changes, I want the Charttitle also to
> change.
>
> Manually I can do this by selecting the charttitle and use the function
> (=D2) on the top of the excel-sheet. But this will not work when I try the
> recorder.
>
> Can anyone help?



 
Reply With Quote
 
Trond
Guest
Posts: n/a
 
      20th Nov 2009
But this won't update when I change the content of D2???


"john" wrote:

> see if this helps:
>
> With ActiveSheet.ChartObjects(1).Chart
>
> .HasTitle = True
> .ChartTitle.Text = Range("D2").Value
>
> End With
> --
> jb
>
>
> "Trond" wrote:
>
> > I have programmed a macro that makes a pivottable and a pivotdiagram. In this
> > diagram I have a charttitle that I want to be equal to the content of one
> > cell (D2).
> > So if the content of the cell changes, I want the Charttitle also to change.
> >
> > Manually I can do this by selecting the charttitle and use the function
> > (=D2) on the top of the excel-sheet. But this will not work when I try the
> > recorder.
> >
> > Can anyone help?

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      20th Nov 2009
Try Peter's suggestion.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



Trond wrote:
> But this won't update when I change the content of D2???
>
>
> "john" wrote:
>
>> see if this helps:
>>
>> With ActiveSheet.ChartObjects(1).Chart
>>
>> .HasTitle = True
>> .ChartTitle.Text = Range("D2").Value
>>
>> End With
>> --
>> jb
>>
>>
>> "Trond" wrote:
>>
>>> I have programmed a macro that makes a pivottable and a pivotdiagram. In this
>>> diagram I have a charttitle that I want to be equal to the content of one
>>> cell (D2).
>>> So if the content of the cell changes, I want the Charttitle also to change.
>>>
>>> Manually I can do this by selecting the charttitle and use the function
>>> (=D2) on the top of the excel-sheet. But this will not work when I try the
>>> recorder.
>>>
>>> Can anyone help?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft Dot NET Framework 1 22nd Nov 2007 11:36 AM
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft ADO .NET 3 22nd Nov 2007 09:17 AM
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft VB .NET 0 20th Nov 2007 04:24 AM
I have a CLR function thet returns IEnumberable (a table) and it has a FillRow function. I am returning 10,000 integers from this function. Is there any way that I can preallocate the resulting table or give SQL server hint as to how many rows my fun DR Microsoft Dot NET 0 20th Nov 2007 04:24 AM
VbScript Function to encode into base64 compatible with .NET function System.Convert.FromBase64String abarberis@gmail.com Microsoft Dot NET Framework 1 20th Mar 2006 11:17 PM


Features
 

Advertising
 

Newsgroups
 


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