Can we return source data address from chart object?

Atroxell

Active Member
Joined
Apr 18, 2007
Messages
422
hi all,

I just got asked a stumper...I know it won't stump all of you for long.

One of my coworkers has a nasty workbook and chart that someone else built. The chart does not actually contain labels that are immediately accessible by the series definitions, even though they are in the source workbook. Even though the layout of the data does not allow for a standard series definition for the labels, there is enough regularity that we think we might be able to automate it to a certain degree so that these labels, which are currently updated manually on a weekly basis, can be updated via a macro. (We did not build this workbook--It's another "inherited workbook" and would cause an uproar from bottom to top if we tried to change the report in any way...)

Anyway, this person is looking for a way to automate the redefining of the text labels in the chart, so he's looking for a way to return the cell address of a text label in the chart object. Once that's is done, he can update the label using a loop of some kind and looping through the Series collection data points and, once he has an address, using an offset method or somesuch to return a value. This would save A LOT of time each week.

I have tried using a recorded macro and managed to get close, but I can't find a way to return the cell address of the label.

Any Suggestions?

Here's what I was able to record, and I can easily change the label by re-defining the cell address I want it to represent. (Which I have already done by replacing the value with a cell reference in this example.)

Code:
Sub Test()
        ActiveSheet.ChartObjects("Chart 8").Activate
        ActiveChart.SeriesCollection(1).Points(3).DataLabel.Select
        ActiveSheet.ChartObjects("Chart 8").Activate
        ActiveChart.SeriesCollection(1).Points(3).DataLabel.Text = Cells(4, 60)                            '"$1,045.33"
End Sub

Hope this is clear!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,215,133
Messages
6,123,233
Members
449,092
Latest member
SCleaveland

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top