473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Renaming an Excel Chart and referencing it by its name

119 100+
I am creating a series of charts on a grid, 2 wide by four long. eg:

chart_1 chart_2
chart_3 chart_4
chart_5 chart_6
chart_7 chart_8

I want to have VBA code to replace an existing chart, in the same location, with a new chart. i.e. I want to be able to replace a chart in position i with a new chart, in position i.

The problem is, I'm not sure how to reference a chart by its location. The ChartObjects index does not refer to the location, only the order in which the chart was created. I had the idea of re-naming the chart by the location holder (chart_i), but I haven't been able to rename an embedded chart, nor reference it by its name.

Any ideas?
Oct 1 '08 #1
1 2421
billelev
119 100+
It was this simple...It just had to be embedded on a worksheet, which obviously wasn't the case when I tried the first time.

Expand|Select|Wrap|Line Numbers
  1. ' Create a new chart at the desired location with the desired name
  2. Charts.Add
  3. ActiveChart.Location Where:=xlLocationAsObject, name:=ch.ChartWorksheetLocation
  4. ActiveChart.Parent.name = ch.ChartName
  5.  
Oct 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
6
by: ghanley | last post by:
Does anyone know how to change the datasource of an Embedded Excel chart in an unbound Object Frame. How to reference the properties?? I want to do something like this. Dim XLChart as...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
0
by: pmclinn | last post by:
The code below takes the data from the S column and grabs all the data and graphs it. The problem is this example grabs 500 cells worth of data and some of these cells = nothing. How do I rescope...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
3
by: toffee | last post by:
Hi all, I got a pre-formatted spreadsheet. would it be possible using js to copy the data from a table on the current webpage, open the spreadsheet and paste the content ? if so, anyone got any...
0
by: madhatter84gn | last post by:
I am trying to automate an excel spreadsheet and then create a chart. Dim chartRange As Excel.Range If rollup Then chartRange = sheet.Range("O2:Q14", Type.Missing) ...
0
by: AlexNunley | last post by:
I am trying to dump data from an access query into excel so I can pretify it. I found sample code from an old access 97 book (The version of access in use)and tinkered it into working. Well sort...
1
by: Ally | last post by:
Hi all, I’m looking to plot charts in Excel from python. After some Googling I’ve found the following code: def plot(x, y, xAxisLog=False, yAxisLog=False): # acquire application object, which...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.