dynamic chart range in vba

hi there,
i have tried several ways of trying to get this dynamice range to work
with my chart. each time i have tried a different error, but this is
the current versio, and the current error is:
Application-defined or object-defined error.
if anyone could shed some light on this for me, it would be muchly
appreciated.
The Code:

' draw the graph of the imported data
Graph:
    sName = Sheets(Sheets.Count).Name
Set rng = Range("D6").Offset(s, 1)

    Charts.Add
    ActiveChart.ChartType = xlXYScatterLinesNoMarkers
    ActiveChart.SetSourceData Source:=Sheets(sName).Range(rng), _
        PlotBy:=xlColumns
    ActiveChart.SeriesCollection(1).Name = "=""Crush Data"""
    ActiveChart.Location Where:=xlLocationAsObject, Name:=sName
With ActiveChart
    .HasTitle = True
    .ChartTitle.Characters.Text = sName
    .Axes(xlCategory, xlPrimary).HasTitle = True
    .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
"Displacement (mm)"
    .Axes(xlValue, xlPrimary).HasTitle = True
    .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Force (kN)"
End With
Range("A1").Select
0
7/30/2003 4:00:46 PM
excel.charting 18370 articles. 0 followers. Follow

1 Replies
355 Views

Similar Articles

[PageSpeed] 24

the crush data was just a constant.
i have now managed to fix it and get it to work.
the rng was part of the problem.
this is the new code:
' draw the graph of the imported data
Graph:
    sName = Sheets(Sheets.Count).Name
Set rng = Sheets(sName).Range("D6").Resize(s, 2)

    Charts.Add
    ActiveChart.ChartType = xlXYScatterLinesNoMarkers
    ActiveChart.SetSourceData Source:=rng, PlotBy:=xlColumns
    ActiveChart.SeriesCollection(1).Name = "=""Crush Data"""
    ActiveChart.Location Where:=xlLocationAsObject, Name:=sName
With ActiveChart
    .HasTitle = True
    .ChartTitle.Characters.Text = sName
    .Axes(xlCategory, xlPrimary).HasTitle = True
    .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
"Displacement (mm)"
    .Axes(xlValue, xlPrimary).HasTitle = True
    .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Force (kN)"
End With
Range("A1").Select

i had a look around your site before, but as they are only for charts
that are to be dynamic once created, whereas i needed this to be
dynamic and created on the fly.
you have a nice site though, plenty of information. clean coding on
the html too, as its not using frames (well, i couldnt pick it up
anyway)

cheers, felix
0
7/31/2003 10:44:22 AM
Reply:

Similar Artilces:

Value Limits In A chart
Is there any way possible to change the color of a data series within a chart when it exceeds a value of another data series? Thanks!! Hi see: http://peltiertech.com/Excel/Charts/format.html#CondChart and http://peltiertech.com/Excel/Charts/format.html#CondChart2 -- Regards Frank Kabel Frankfurt, Germany "Robby" <Robby@discussions.microsoft.com> schrieb im Newsbeitrag news:03E95BC9-B246-41E9-A941-177C2C22CB4F@microsoft.com... > Is there any way possible to change the color of a data series within a chart > when it exceeds a value of another data series? > > Tha...

Data markers in a stacked chart will not sit side by side by month #2
How can I get the monthly columns (ie: July Actual & July Budget) in a stacked chart to sit side by side with a space before the next month (August Actual & August Budget) and so on for each month. ...

Pivot Chart in Excel 97
Hi guys, i was wondering if anyone knows a way to provide a dynamic chart based on a pivot table with similar functionality to the pivot chart in Excel 2000 or newer? Cheers The Frog *** BUMP *** 24hrs Bump has no meaning in newsgroups. Mr.Frog.to.you@googlemail.com wrote: > *** BUMP *** 24hrs It got your attention Bob :-) Mr.Frog.to.you@googlemail.com wrote: > It got your attention Bob :-) Yes, but what was your orignal question? If you had quoted it in your "bump" you had at least a chance of an answer. But this is a newsgroup and folks don't generally kee...

service calendar in MS Dynamics 4.0
Does anyone knows how we can achieve the following requirement with MSCRM 4.0 In the service calendar in MS Dynamics 4.0 you are able to create new appointments and service activities. Appointments and Service Activities which are created will be present in the Service Calendar. To see all details of such a record[Subject(default Value)] you must open it. But by moving your mouse on the concerning appointment or service activity, a text-box-view appears with primary information. With appointments the content of the following fields is displayed: 'show time as', 'subject...

How to freeze a range in excel 2003and 2007
I want to freeze a group of cells in excel 2007 but when I click on the freeze panes, top row or first column: nothing happens- I mean it scrolls up and down. Also is there anyway I can print an excel worksheet which is several pages long and still have the headings (which is in say the first 3 rows ie A1 - E1 down to A3 - E3) printed on each page? Lets say the headings are on only page 1 but i want it to be on page 2,3,4 to the last page when printed. Can freezing do that? Thanks. Hi In order the Freeze Panes, your cursor needs to be one cell below, and one cell the the right of the Row an...

Chart tabs changing by themself
I have an Excel 2007 spreadheet (.xlsx) file with about 40 charts all in their own sheets. Every one of those sheets used to have their own descriptive tab name. Excel does not seem to like that, however, as sometimes after closing, it just deletes all of my tab names replacing them with a generic Chart3, Chart4, Chart 5 etc. This is highly frustrating of course. I once edited every one of those tab names back to their original names, wasting a lot of my time in the process, hoping it would not happen again. Alas, it sporadically happens again and again... Any ideas/solu...

dynamic resource
Hi, Anybody know how to load e.g. bitmap into resource dynamicaly? The bitmap file will be downloaded by application itself , so it has to be somehow inserted into resource and displayed. thanks What do you mean by "into resoure dynamically"? Do you want to load a ..bmp file and display it? If yes, take a look at GDI+, which is by far the easiest way to achieve this. ---------- Ajay Kalra ajaykalra@yahoo.com I misspelled this, yes I'd like to load new bitmap on the fly. But resource file looks like is static. I use ATL/MFC applicatation. "Ajay Kalra" <aja...

Stop named ranges being copied
I want to copy a worksheet from one workbook to another. But I do not want to copy the named ranges associated with the first workbook to the second. How do I prevent named ranges being copied when I move sheets. >>How do I prevent named ranges being copied when I move sheets. You can't. A named range is just as much a part of a sheet as anything else. Delete the name(s) after you copy a sheet. -- Jim <bmatheson@gmail.com> wrote in message news:1183722346.818571.213860@q75g2000hsh.googlegroups.com... >I want to copy a worksheet from one workbook to another. > >...

VBA Conditional Formating Using Logical Expression
I am new to VBA so please provide as much explanation in your responses as possible as I would love to learn more. I have a set of data (call it range 1) that resides in specific cells (all in one column) and does not change. I have another set of data (call it range 2) that is spread across 5 columns and occupies the same rows as range 1. Range 2 values in each of the 5 columns relate to the Range 1 data in the same row. I need to set up more than three conditions using >, <, = or n/a to determine the color of each of the cells in range 2. As data is entered into th...

Adding Comments From Cells To Chart Points.
Hi all I have spent a large portion of my weekend trying to find the answer to this. Without much luck! I have finally come up with my own code and was hoping someone could have a look at it. I'm looking to clean it up and make it a little more efficient. Thanks in advance, Greg. Sub AddCommentsToChartPoints() Dim ws As Worksheet Dim ct As ChartObject Dim serSeries As SeriesCollection Dim ser As Series Dim Counter As Integer Dim ChartName As String Dim xVals As String Dim xAddress As String 'Loop through each worksheet in workbook For Each ws In Worksheets 'Lo...

Combining multiple Stacked Charts
I have 3 scenarios with info on Asset A and Asset B for 10 years. I can create stack charts for each scenario independently, but can not figure out how to combine all 3 onto 1 chart across multiple years. x axis is year and each year should have 3 stacked lines Y Axis should be total value of both Assets Any help appreciated Does this help? http://peltiertech.com/WordPress/2008/05/19/clustered-stacked-column-charts/ - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "JANeyer" <...

Dynamic sum in Chart
Hello: So I've got this pivot chart that I've created, and it's great, EXCEPT when I select different categories to show up, I want to show a SUM of the categories, not the values of each category. I would appreciate any help/advice you may have. Thank you! Michelle In the pivot table you can select different thing like count and SUM etc. If you right click in the upper left vacant square and chose field settings, then select what you want to see in your data section. Misha wrote: > Hello: > > So I've got this pivot chart that I've created, and it's great...

SharePoint Alternate Access Mapping to my Dynamics GP BP site
Hello, If I have posted this question in the wrong forum please let me know! I’m looking for some guidance on changing the Alternate Access Mapping for my Dynamics Business Portal site. So I can implement Single Sign On via ISA Server which is supported on one web listener. Present configuration: Default Zone: http://geneva:222 I would like to add: Internet Zone: http://dynamicsbp.proclub.com I presently have another SharePoint Collection (The Main Portal) http://geneva configured which listens on Port: 80. I tried to add the Alternate Access Mapping http://dynamicsbp.proclub.com...

Using Formulas with Charts
I have a chart that references cells with the following formula =if(a1="","",a1/a2). The formula is used for each month Jan-Dec. I would like to copy the formula across all months. When I do this my data point show as zero for months that have not happened yet. What can I do to not show a line on the chart for a data point with a "" or null value? Thank you, Sandy The cell with the formula isn't blank, and "" does not produce a blank. There is not a formulaic way to simulate a blank, but for many cases, a line chart or XY chart will treat...

How to load specific range of html into Excel?
For excel 2003, does anyone have any suggestions on how to load specific range of html into Excel? For example, I would like to load following link for HKB into sheet(HKB), because the page is so long, and I cannot import the whole page into excel with limited rows. http://www.hkex.com.hk/eng/stat/dmstat/dayrpt/dqe100302.htm#HKB I would like to load starting from "CLASS HKB - HSBC HOLDINGS PLC" .... [all texts are included] until the following text is found, then stop loading, and the following text is not included. "CLASS HKG - HONG KONG & CHINA GAS" ...

Area Charts
I have four lines that each define a horizontal zone. When I change each to an Area Chart, it appears that the color is only painted above each line and the color extends from the line all the way to the top of the chart. But above the top line I'd like this to be uncolored. I want the top two areas are filled in BELOW each line to a horiz. mid-point on the chart and the bottom two areas are filled in ABOVE these lines to a horiz. mid-point. In effect I want the chart to depict from top to bottom: Empty space Danger zone Safe zone Safe zone Danger zone Empty space Help!! Cr...

Tab seq dynamically...
I have a button which added dynamically to a property sheet. Now for setting the tab sequence with this new button, Am using SetWindowPos() method. Now tab sequence is proper. THE PROBLEM IS Through the arrow keys, I could not navigate to the last button for which I called SetWindowPos. where as through tab keys I could go to the last control. I will appreciate ur help in this. DETAILED DESCRIPTION I have three buttons (OK,Cancel, Help)on the property sheet. I added a button "Default" to the property sheet and positioned between Cancel and Help. I set the tab sequence as ...

Page header and footer for charts from my template
I plot a lot of Y vs X data as scatter plots. Usually, I want the graphs as separate sheets. For these sheets, I want a standardized header and footer. Presently, I do this manually by 1. Select the chart location as New sheet, with a name 2. In the new sheet, click the Print Preview button 3. Click Setup... 4. enter Custom Header and Custom Footer data. I always enter the same data in step 4 above. It should be ideal for a template. Is there a way to use a template for this? Next time you add charts, assuming you add them to end of your workbook, click the last sheet that already...

dynamic charting #2
Hi I have to update a weekly spreadsheet With week numbers in column B x series and three y series percentages in G,H,I columns. Could someone please help I need these to update automatically. If someone can explain in detail I would appreciate 39 2097 2165 68 1770.7 97 96.86 118.43 40 2443.15 2201 -242.15 1548.93 97 111.00 157.73 41 2162.83 2259 96.17 1600.78 97 95.74 135.11 42 2163.08 2241 77.92 1545.1 97 96.52 140.00 43 2137.5 2271 133.5 1664.6 97 94.12 128.41 44 2160.67 2298 137.33 1455 97 94.02 148.50 Ta Brian ...

Combine Bar with Single Line Chart
Hello, Please can someone help me with this question. I am trying to create a bar chart with a single line chart. The bars will display the totals for various years i.e. 2004 104 2005 107 2006 108 2007 110 2008 101 The line chart will show how 2008 is performing on a weekly basis i.e. 01/01/2008 = 100 07/01/2008 = 101 14/01/2008 = 102 The bar chart for 2008 will reflect this also, updating each time a new week is added. The Y Axis I will assume display a total i.e. 99-111 for example. The X Axis needs to show the dates plotted for the line chart 01/01/2008 - 31/12/2008 (weekly) but how...

Need a method to Dynamicly change the X axis Scale on a chart. #2
I dynamically change the amount of data on a chart. This causes the X axis Scale to either to either show too few values or too many values ( a solid black line if too many). I would like a method to dynamically change the scale values in relation to the data span. Joe - Do you want to limit the number of points displayed? http://peltiertech.com/Excel/Charts/Dynamics.html http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=246 Or do you want to link the axis scales to something you calculate in the sheet? http://peltiertech.com/Excel/Zips/SwitchXYAxes.zip - Jon ----...

Dynamically populate a drop down list
Hi, I'm trying to dynamically populate a drop down list in MS CRM (1.2) based on certain parameters. I suppose I could do it using a SQL stored procedure, but I would prefer to use standard/supported CRM customizations. Any assistance in this would be greatly appreciated. Thanks! -Dave- Dave, You can do it in 3.0 pretty easily based upon an example in the SDK... Here are some pretty pictures... http://blogs.msdn.com/midatlanticcrm/archive/2005/12/04/499868.aspx I have not tried it with 1.2, but it could probably work... Thanks Ben "Dave" <renor321@yahoo.com> wrot...

How do create a basic line chart using Excel?
I am trying to create a basic 2 dimensional line chart using the following data: X-axis Y-axis DATA DATA "Rating" "Time" "Rating" "Time" 5 02:00.0 5 02:00.0 4 02:04.7 5 02:08.6 3 02:09.5 4 02:17.2 2 02:14.2 4 02:19.1 1 02:18.9 4 02:28.0 02:23.7 4 02:28.2 02:28.4 4 02:29.2 02:33.2 4 02:33.1 02:37.9 3 02:36.9 02:42.6 3 02:41.2 02:47.4 3 02:42.1 02:52.1 3 02:44.2 02:56.8 3 02:48.8 03:01.6 3 02:48.9 03:06.3 3 02:50.6 03:11.1 3 03:00.2 03:15.8 3 03:02.9 03:20.5 3 03:04.9 03:25.3 3 03:05.7 03:30.0 ...

CRM Integration with MBS/Dynamics products
Hi, Anyone know anything about the integration between CRM 3.0 and ...say.... Dynamix AX/Axapta? I'm thinking sharing of customer data and such.... Jeppe Jespersen Denmark There is nothing available yet. You would need to build it. -- Matt Parks MVP - Microsoft CRM "Jeppe Jespersen" <jdj curly jdj dot dk> wrote in message news:OAfVImWLGHA.3276@TK2MSFTNGP09.phx.gbl... Hi, Anyone know anything about the integration between CRM 3.0 and ...say.... Dynamix AX/Axapta? I'm thinking sharing of customer data and such.... Jeppe Jespersen Denmark ...

transparent level/limit in an Excel chart (3D)
Ecxel 2003 I'd like to set a transparent level as a limit in a 3d bar chart. It needs to be transparent so I can see values less than and allow values greater than to "breakthrough". Any ideas or do I need to by an upgrade or different software. I need this to look professional. Excel 3D charts are not very flexible. But that's okay, because 3D charts are often misleading and can distort the data. Excel 2D charts don't suffer from this distortion, and they can accommodate lines that show limits such as yours. If you need 3D charts, you should shop elsewhere. - Jo...