Solved

Link cell references to chart titles

Posted on 2011-03-25
8
715 Views
Last Modified: 2012-05-11
Dear Experts:

I got several embedded charts (n= 10) on the active worksheet.
They all got a dummy chart title (Sales 2011)
I got a column with 10 countries entered in the respective cells, starting in F1, i.e. Germany (F1), England (F2) ... Greece (F10).

A macro should achieve the following:

Looping thru F1 till F10 and rename the Chart Titles of the embedded charts to Sales 2011 Germany, Sales 2011 England, .... Sales 2011 (Greece).

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
  • 4
  • 3
8 Comments
 
LVL 50

Expert Comment

by:Dave Brett
ID: 35213971
While you can do this with code it would require the charts to be in "correct" order dwon the sheet for the titles to be labelled appropriately. Are they descending or side by side?

Note that you can quickly link each cell title to a cell reference a via the edit bar without using code

Cheers

Dave
0
 
LVL 33

Assisted Solution

by:jppinto
jppinto earned 100 total points
ID: 35213977
Why do you need a macro to do a job that takes less than 5 minutos to do?!? It takes more time to make the macro and put it on the file then do the job by hand! If it where 100 charts, that would be worthy to do a macro, but 10?!

Just go to each chart and click on the chart title and on the formula bar put like =A1 on the first, =A2 on the second and so on...

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35213987
Please take a look at the attached image...
Capturar.JPG
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:Dave Brett
ID: 35213999
That point had been already made
>Note that you can quickly link each cell title to a cell reference a via the edit bar without using code
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 400 total points
ID: 35214021
If you were set on code rather than the manual edit bar AND your charts were arranged in the correct order you could use VBA like this sample code and file

Cheers

Dave
Sub ChtTit()
    Dim lngRow As Long
    Dim chr As ChartObject
    For Each chr In ActiveSheet.ChartObjects
        chr.Chart.ChartTitle.Text = [f2].Offset(lngRow, 0).Value
        lngRow = lngRow + 1
    Next
End Sub

Open in new window

chtTitle.xlsm
0
 

Author Comment

by:AndreasHermle
ID: 35217014
Dear Dave, jppinto:

thank you very much for your great and professional support:

jppinto: I am fully aware that I could easily change the chart titles the way you describe. But as you also mentioned, if , say hundreds of charts have to be worked on, a macro would be the best solution. And this may be the case sometime in the future.

Thank you very much again for your great support.

Regards, Andreas
0
 
LVL 33

Expert Comment

by:jppinto
ID: 35217173
Thanks for your response. Glad you found a solution..

regards,

jppinto
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 35219891
Thanks for the grade :)

Dave
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question