Annotate Chart with Text Boxes

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

I have some charts that are annotated with Text Boxes that line up
with that Months data. If I add extra months to the Chart then I have
to move all the Text boxes along a little to the left to remain
matched up with the Data it corresponds to, can this be automatically
done?

Thanks

Pete
 
Hi,

Textboxes by themselves will not track your monthly data. For that you
would need to use data labels.
To update the textboxes would require VBA code to calculate there
position in relation to the chart and the data.

Cheers
Andy
 
Hi,

Textboxes by themselves will not track your monthly data. For that you
would need to use data labels.
To update the textboxes would require VBA code to calculate there
position in relation to the chart and the data.

Cheers
Andy

Andy,
I think I've misled you. I don't want to update the Text in the Text
Boxes I just want them to remain lined up with the Month that they
correspond to when extend the Range of the Source Data for the Chart.
 
That's what Andy was referring to, by "calculating their position".

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


Hi,

Textboxes by themselves will not track your monthly data. For that you
would need to use data labels.
To update the textboxes would require VBA code to calculate there
position in relation to the chart and the data.

Cheers
Andy

Andy,
I think I've misled you. I don't want to update the Text in the Text
Boxes I just want them to remain lined up with the Month that they
correspond to when extend the Range of the Source Data for the Chart.
 
That's what Andy was referring to, by "calculating their position".

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.http://PeltierTech.com/WordPress/
_______





Andy,
I think I've misled you. I don't want to update the Text in the Text
Boxes I just want them to remain lined up with the Month that they
correspond to when extend the Range of the Source Data for the Chart.- Hide quoted text -

- Show quoted text -

Hi,

Don't suppose you could give an example of the code required or know
where there is an example. VBA is not my strong point.

Thanks

Peter
 
Why don't you top post like everyone else, so it's easier to find what you
have written?

Andy said it "would require" VBA to keep the labels in position. But if you
use data labels it wouldn't.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


That's what Andy was referring to, by "calculating their position".

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.http://PeltierTech.com/WordPress/
_______





Andy,
I think I've misled you. I don't want to update the Text in the Text
Boxes I just want them to remain lined up with the Month that they
correspond to when extend the Range of the Source Data for the Chart.-
Hide quoted text -

- Show quoted text -

Hi,

Don't suppose you could give an example of the code required or know
where there is an example. VBA is not my strong point.

Thanks

Peter
 
Hi,

Here is a simple coded approach to the problem if using data labels alone is
not sufficient for the formatting of your annotation.

Start by adding a dummy series to the chart. Make sure the Series name is
blank or a single space.
Use the same values as the main series. Apply data labels to this series.
The Left and Top property of the data labels can now be used to re-position
textboxes.

Sub Demo()

Dim chtTemp As Chart
Dim shpTemp As Shape

With ActiveSheet.ChartObjects(1).Chart
Set shpTemp = .Shapes("Text Box 1")
With .SeriesCollection(2).DataLabels(3)
shpTemp.Left = .Left
shpTemp.Top = .Top
End With
End With

End Sub

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
That's what Andy was referring to, by "calculating their position".

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.http://PeltierTech.com/WordPress/
_______





Andy,
I think I've misled you. I don't want to update the Text in the Text
Boxes I just want them to remain lined up with the Month that they
correspond to when extend the Range of the Source Data for the Chart.-
Hide quoted text -

- Show quoted text -

Hi,

Don't suppose you could give an example of the code required or know
where there is an example. VBA is not my strong point.

Thanks

Peter
 
Sorry Jon, didn't realise I was doing anything wrong, I just hit the
Reply Button. I thought Data Labels were just a copy of the Values
used for the Chart. I didn't realise you could Edit them.

Peter
 
Back
Top