![]() |
click data point in chart and delete
does anyone hava a routine for clicking a data point in a chart and
deleting this point either from the series or from the worksheet it's being referenced from? thanks. smokii |
click data point in chart and delete
I don't have such a routine. At this point, it doesn't look like anyone else
has either. My thoughts on the subject follow. Simple approach: If you're unaware, you might want to consider Excel's existing point manipulation featu i) Click on any point in the series to select the series. ii) Then click the desired point to select it. The mouse pointer should change into either a four-way or up-down arrow if done correctly. iii) Drag the point to the desired value. You can't to my knowledge delete it however. But you can drag it so that it's in line with the preceeding and following points in the series thus nullifying its affect on trendlines etc. The above assumes that the points in the series are simple values as opposed to formula results. In the latter case, you will likely need a routine to copy the formula results (as values) to the plot range so that the chart links only to these values. Complex approach: If the above "Simple approach" is not acceptable then I think you would be looking at creating a Class module and, using the Mouse_Down event and GetChartElement function, determining the point clicked on, and have code take it from there. I think my approach would be to have three ranges: 1) The first holds the x-values 2) The second holds all the original y-values 3) The third holds the plotted y-vlaues. At the start, the second and third ranges would both contain all the y-data. When you click on the desired point, GetChartElement returns the selected series index value (arg. a) and the selected point index value (arg. b). Code would then clear the y-value from the third range corresponding with the selected point using the index value as an offset. After deleting all the desired points (clearing the cells in the third range) you could have a reset function that repopulates the third range using the second as the source. However, this should be OK so long as there arn't too many points involved. If there are several, and if you change your mind or accidently click the wrong point, then resetting and starting from scratch might be unacceptable. An alternate approach would be to actually have two series: The first series plots all the points (i.e. the above 2nd range). This series would not plot a line, just point markers. In contrast, the second series would not plot point markers but instead would plot the line. When you click on a point marker from the first series, the point marker would toggle from a filled condition (indicating a plotted state) to a non-filled condition (indicating an unplotted state). GetChartElement would then identify the offset for the clicked point and either clear or repopulate the cell from the third (plotted) range depending on whether the clicked point marker was filled or non-filled. Most likely, within 2 nonoseconds or so, someone will follow my post with a fully working routine perfect for your needs. Best regards, Greg You can drag it so that it's in line with the preceeding and following points therefore nullifying its affect. " wrote: does anyone hava a routine for clicking a data point in a chart and deleting this point either from the series or from the worksheet it's being referenced from? thanks. smokii |
click data point in chart and delete
If you're still interested (and monitoring this post), then I put together a
macro that demos what I discussed. It creates 3 dynamic named ranges plus a demo chart with two series. The first series displays only point markers (no line) while the second series displays only a line plot (no point markers). It allows you to click on points to toggle their exclusion/inclusion from the line plot. If a point marker from the first series is filled (MarkerBackgroundColorIndex 0) then clicking on it clears its fill (MarkerBackgroundColorIndex = xlNone) and deletes the associated y-value from the line plot. If the point marker is not filled then clicking it reinstates the fill and the associated y-value is added to the line plot. You have to hold down the <Alt button while clicking for it to work. Else, it's a huge nuissance. The macro is designed to work with an embedded chart but can be rigged to work with a chart sheet. Regards, Greg |
click data point in chart and delete
I'd be very abliged. Tahnks for your input. :)
|
click data point in chart and delete
I'd be very abliged. Thanks for your input. :)
|
click data point in chart and delete
|
click data point in chart and delete
|
All times are GMT +1. The time now is 05:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com