Excel - Vertical line on Excel chart
Asked By septimus on 15-May-12 03:02 PM
I have a bar chart in Excel. I want to add a series of vertical dotted
lines at certain points on the x axis.
I can do this manually using Insert -> Shapes -> Line, but I want to
do it programatically.
I am able to put dotted vertical BARS (not lines) at the desired
points. And I can put a dotted line that runs across the bottom at
zero and then goes up at tne desired point, but neither are really
There must be a way to do this?
Martin Brown replied to septimus on 15-May-12 05:49 PM
In XL2003 or earlier macro capture should work enough to allow you to
see what you would have to do. Versions after that all bets are off.
If you mean to do as cursors at specific scaled points on a graph then
it is possible programatically but you have to provide separate versions
for XL2003 and earlier and XL2007 and above.
Getting the lines to sit exactly where you want is amusing as there are
plenty of quirks if the y graph scale gets switched to log for instance.
septimus replied to Martin Brown on 16-May-12 03:21 PM
I am using Excel 2007. Recording a macro does not seem helpful; it
catches when I copy a line but not when or where I paste it.
What I'd really like is to create a data series of vertical dotted
lines. Is that possible??
Martin Brown replied to septimus on 17-May-12 08:38 AM
Macro recorder in XL2007 is extremely unhelpful and seriously broken.
It is possible. I have used a similar method to allow users to put
integration limit cursors on a graph of data. But I cannot see why you
would want to plot a whole data series that way. Custom graph paper?
septimus replied to Martin Brown on 17-May-12 02:02 PM
My client wants to visually break the chart into sections to make the
chart more readable. There would be a vertical dotted line at the
beginning of each section.
So how is it possible? What would you do to accomplish this?
but I want to