advanced excel course london - naming charts created macro

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » advanced excel course london - Naming Charts Created by a Macro

advanced excel course london - Naming Charts Created by a Macro

resolvedResolved · Low Priority · Version Standard

Zohra has attended:
Excel Advanced course
Excel Intermediate course
Excel VBA Intro Intermediate course

Naming Charts Created by a Macro

Hello,

I've set up a macro to create a couple of charts. I'd like the end of the macro to resize the graphs and have done this by recording another macro. However, I can't seem to get the end to refer to the right chart object- is there a way of naming the chart so that I can use

ActiveSheet.Shapes("Chart Name").IncrementTop XX

?

RE: Naming Charts Created by a Macro

Adding in an example of where it goe swrong:

ActiveChart.Name = "Chart 13"
'at this point the chart is named "Chart 13"

ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
'at this point it changes and the next line produces an error

ActiveChart.Name = "Chart 13"

RE: Naming Charts Created by a Macro

Zohra

i think that you may need to reselect the chart ie

use Charts("Chart 13").Select

instead of the line ActiveChart.Name = "Chart 13".

If that doesn't work you could send the spreadsheet where the error occurs to

info AT stl-training.co.uk and mark it to the attention of Carlos

I'll have a look at how the code is working and hopefully come up with an answer.

Regards

Carlos

 

Training courses

 

Training information:

See also:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Transpose text

You can transpose any range of cells, turning the columns into rows and the rows into columns. Just follow these steps:

Select the range.

Click the Copy button on the Standard toolbar to copy it to the Clipboard.

Select a cell outside of the range you copied.

Select Paste Special from the Edit menu.

In the Paste Special dialog box, click Transpose, then OK.

View all Excel hints and tips


Server loaded in 0.1 secs.