Charts.Add Adds Pivotchart, Error On SetSourceData
Jan 23, 2007
I have the following extract of code which is meant to add a chart. However, it adds a pivotchart and then errors on the last line because it can't change the source data on a pivotchart like it can on a non-pivotchart. All of the other charts in the workbook are pivotcharts. It was working fine last week.
Sheets "LOI Sheet" and "Data for Charts" exist.
"e" is a defined integer with value 53 at last running.
=COUNTIF(F3:F38,"=VL") This works for totaling the VL in the cells in the column but what if I need it to add DVL in the same column to that total? So I need it to add both VL AND DVL as one total. I can make it add one or the other but not both
I have created a pivotchart and placed it on (say) sheet " GRAPH". Excel has created the associated pivottable and stored it on (say) sheet "PIVOT".
Because the formating of the graph is lost each time the pivotgraph is refreshed i.e page fields changed, i have written a small macro to reformat it which i have put in the "Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)" event in the "PIVOT" sheet. All appeared to work well.
However, on closer investigation, i noticed that the pivotchart wasn't being updated (even though the source pivottable was set to refresh on open - another problem for another day?) so on the pivotchart sheet i had to press the little red exclamation mark to update it and the chart changed before my eyes. I thought I would then record a macro to see what i had to do.
The code the macro recorder gave was "ActiveChart.PivotLayout.PivotTable.RefreshTable" so i simply inserted this into the chart.activate event of the "GRAPH" sheet and assumed it would kick in everytime the graph was activated.
However, it crashes everytime with an error message "unable to get the pivotfields propety of the pivottable class". If I put an msgbox in the relevant "Sub Worksheet_PivotTableUpdate" to display the target. name, its blank!
I've tried all sorts of work arounds like trying to update the pivottable in the graph activate event:- dim pt as pivottable : set pt = ......... : pt.refreshtable etc select the sheet before hand etc, etc but no joy.
Following the code through debug it always crashes with the same message. If I manually update the pivottable on the PIVOT sheet (right click "refresh data") the table gets refreshed which then triggers my graph reformat code and everything is fine.
I'm sure i'm doing something wrong but it doesn't appear to like the chart and table being on different sheets?
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
msgbox Target.name <---------ERROR (Blank!)
If Target.PivotFields("BusinessArea").CurrentPage = "XXXXXX" And _ (Target.PivotFields("BM").CurrentPage = "AAA" Or _ Target.PivotFields("BM").CurrentPage = "BBB" Or _ Target.PivotFields("BM").CurrentPage = "CCC" Or _ Target.PivotFields("BM").CurrentPage = "DDD") Then MsgBox "Error - " & Target.PivotFields("BM").CurrentPage & " is not a valid Business Manager of " & UCase(Target.PivotFields("BusinessArea").CurrentPage) & vbCr & vbCr & "Please try again!!", vbCritical, "Error" Exit Sub End If
..graph reformat code (irelevant because even If i delete this it still bombs out!" End Sub
I receive the following error: Run-time Error '1004':
The source data of a pivotchart report cannot be changed. You can change the view of data in a pivotchart report by reorganizing its fields or items, or by changing its associated PivotTable report.
I created a bar chart with horizontal (category) labels: winter, spring, summer, fall. Y-axis label is percent. For each category there is data for blk rats, Norway rats, Mice. For each species and category the standard error is different because it is based on several years of data for a given season.
When I try to display the std. error (using custom, fixed value) it treats each species as a series and only lets me choose one value. in other words the std. error would be the same for blk rats in winter, spring, etc. How can I use the individual values?
This works perfectly on one PC, but fails when I try to run it on a different PC. Both PC's use Windows 2000, and both run Excel 2000.
The error message I get on the second PC is:
Run-time error '1004': Method 'Export' of object ' _Chart' failed
What I need to find out is what could possibly be causing this statement to fail. Is there something in the Excel or Windows settings that could be different (a dll file etc)?
I have created a dynamic chart, courtesy of the Jon Peltier website. I have 2 problems. No problem with getting the chart to work, the problem comes when I delete the data. I get an error message telling me that 'A formula in the worksheet contains one or more invalid references.' The other problem is that I cannot copy the worksheet to another worksheet in the same workbook. Well that is not strictly true, I can copy it but it wont updat. Any ideas as to how I can overcome this? Any suggestions welcome, apart from 'Don't delete the data then'
I am using defined names to build a chart. This is working fine, but I also would like to use a defined name to control the +/- fields for the error bars. The defined names I have set up are correct, and I am able to enter them into the sorce data form but Excel does not display them.
I've got an interactive chart on a sheet where users select a chart from a combo box control and a picture link to the chart is displayed. The actual charts are on a hidden sheet. I have to activate the charts first for it to work so I put a button the sheet and recorded a macro where I unhide the hidden sheet, select each chart as I scroll down the screen by clicking on it then hide the sheet again and return to the interactive chart.
My problem is that I'm getting an error when the macro tries to select the first chart which is called "Chart 6":
Run-time error '-2147024809 (80070057)':
The item with the specified name wasn't found
I recorded the macro so I'm not sure why the macro isn't working now.
Code: Sub ResetCharts() ' ' ResetCharts Macro ' Reset all charts ' ' Sheets("Budget v Actual Graphs").Select Sheets("Graph BG").Visible = True ActiveSheet.ChartObjects("Chart 6").Activate ActiveChart.ChartArea.Select ActiveWindow.SmallScroll Down:=15 ActiveSheet.ChartObjects("Chart 35").Activate
I have a file with data in one sheet (unfortunately I cannot share the file because of confidential data..), and two sheets with both 9-11 charts in them.
The charts are all filled simply with a dynamic range from the datasheet, so that Last Year and all months from this year with data in them are always in there.
The problem: When opening either of the graph sheets, the (familiar?) error pops up: "A formula in this worksheet contains one or more invalid references. Verify that your formulas contain a valid path, workbook, range name and cell reference."
One of the graphs has an error and only shows one point of data in it. But only until I press F9, and then the chart is repaired and functions perfectly like all the others!
I have tried lots of things, including checking all source ranges, deleting all graph names etc. and then repaired it so it would work again. The only thing that happened, is that the same error now pops up for another graph in the sheet. Still, when you press F9, the graph functions again!
In the attached document is a timeline made from a scatter chart. Error bars using custom values are used to show the length of each task, however I can't get the chart to include error bars for the last 2 data points (tasks).
I have the following code for a sheet in my workbook that has 3 charts:
Private Sub Worksheet_Change(ByVal Target As Range) Application.Calculation = xlCalculationManual ActiveSheet.ChartObjects("RdteObs").Chart.SetSourceData ThisWorkbook.Names("GSumRdteObs").RefersToRange ActiveSheet.ChartObjects("RdteWip").Chart.SetSourceData ThisWorkbook.Names("GSumRdteWip").RefersToRange ActiveSheet.ChartObjects("RdteExp").Chart.SetSourceData ThisWorkbook.Names("GSumRdteExp").RefersToRange Application.Calculation = xlCalculationAutomatic End Sub
but whenever the sub runs, I get this error message: "Excel cannot complete this task with available resources. Choose less data or close other applications." Does anyone have an idea what's going on?
When i add a month coloumn,Sparklines and Average coloumn should get updated automaticaly.Now this is not happening even if the data is in table format.I also want the graphs to be automaticaly updated.
I am trying to put some charts into a report that is pivot table based. I have some code that will work if the pivot tables stay stagnic but the users may change the tables around so that could be an issue of new data. I have the following code where I changed the source to the pivot table name (general name because of numberous report possibilites). I have taken out the other charts because they are just a variation of the chart 1. I am crashing on the line with the * on it.
Sub UWTierChart() Dim oCell As Range Dim oChart As Chart Set ws_data = ActiveSheet 'Chart 1 Sheets(wsPT).Select Range("B21").Select
I have a spreadsheet for my local camera club that needs a few "IF" formulas that I have not a clue at how to accomplish. I have done the rest of the spreadsheet.
The formula needs to be
IF cell A1 = 22 or 23 or 24 (a manually entered number) then the answer = 1 IF cell A1 = 25 or 26 or 27 (a manually entered number) then the answer = 2
Also need another IF formula that adds up various cells: A1 + A2 + A3 + A4 and then adds the same cells on a 2nd and 3rd worksheet, and if the total is zero, then the cell will remain blank in the answer field, rather than having a zero in it.
Is there a formula or a function that adds up all of the sums in a row.
******** ******************** ************************************************************************>Microsoft Excel - Book4___Running: xl2002 XP : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutA14=ABCD14603 Sheet1 [HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name boxPLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
I have a macro launched from a command button that sometimes puts a bar at the left side of the window. When it executes the line Sheets("graph").Select the first line in the macro it puts the bar at the right side of the window. The characteristics of the bar are:
1) It is associated with the main excel window - if you minimize the window containing the worsheet the bar is still visible
2) It is one of two widths, about 1/4" or about 2.5"
3) If you move an Excel toolbar to the left side of the screen the bar disappears. If you move the toolbar back to the top of the page it doesn't return but it can appear the next time you run the macro.
4) It only appears some times you run the macro - I can go days without seeing this problem and then it happens every time I run the macro.
what i would like to do (forgive me if i have missed something) is for the total value in colum D to add up but for the % in column E not to be included in the total %
Is it possible to have a situation that when the word"SURCHARGE" is in the row then the % will not be added to the total %
In other words i need the surcharge price to be included into the final price, but the surcharge would give me a false figure so that needs not to be included in the total %
People usually keep track of their own points, however an official would need to confirm that they are correct before approving a purchase. However 99% of the time, people have the incorrect point totals.
I am currently working on a book to automate the system. It means players wouldn't have to keep track of their own points and that the point totals are always up to date. The first sheet in this workbook is a summary page which has player names, points from posting, bonus points, level up costs, purchase costs etc. Then there is a database with all the costs, which I pulled from the site. Then there are numerous record sheets, which have the player name, the item bought/levelup purchased, and the cost, which is pulled from the database via vlookup. Here is where it gets irritating.
On the summary page I attempted to use SUMIF in the total fields (total cost of purchases, total cost of leel ups etc). It would basically search the record for any entries with the name matching that of the player, and add the amounts associated with that entry. However it would always return 0. After doing some playing around I came to the conclusion that whilst the VLookup returns the correct values, functions like sum see them as 0. So instead of it going 5+7+7+10=29, it says 0+0+0+0=0.
I have a really strange issue on one machine. The end-user gets Excel reports emailed to him. When he opens certain ones, there is an extra space (almost a line without borders) on certain rows. This only happens on some of the files he receives
AND
This behavior is only on his system. On all other recipients' machines the spreadsheets do not have the extra space on some rows. It does not matter if he opens the attachment within Outlook or saves and opens in Excel from the save location.
I have tried resetting the defaults and that does not work.
I need to create a function that adds a predetermined amount (lets say 120) to a cell (lets say A1) every time another cell (lets say B1) reaches a 10 (like 10,20,30,40 etc)
Lets say the B1 is 30, i need A1 to recognize that it needs to show 360 as its value (adding 120 for every 10 of B1)
How can i do this using Excel 2007. I have to cells, A1 and B1. A1 is always Positive whereas B1 might be Positive or Negative. I need a calculation/formula in C1 that ADDS cells B1 and A1 (B1+A1) IF B1 is Negative and SUBTRACTS A1 from B1 (A1-B1) IF B1 was Positive.
I would like to have a macro which adds all the numbers in a column. The problem is that sometimes there are less sometimes there are more numbers. What I would like is, that the macro to sum the numbers right under the last cell which contains a number.
I don't think there is such a function but is there a way that I can have a function that constantly adds the numbers in a column and when the sum of 240 is reached it adds 30. I need it to do this only once and not keep adding at every 240 point.