LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Macro to graph (or draw) a vertical line on the chart


--
Cool


"Joel" wrote:

This will add a line with a macro

Sub createline()

For Each cht In ActiveSheet.ChartObjects
' MsgBox cht.Name

Next cht

Set a = ActiveSheet.ChartObjects("Chart 1")

With ActiveSheet.ChartObjects("Chart 1")
LeftGraph = .Left
TopGraph = .Top
WidthGraph = .Width
HeightGraph = .Height

With .Chart
With .PlotArea

LeftChart = LeftGraph + .InsideLeft
TopChart = TopGraph + .InsideTop
WidthChart = .InsideWidth
HeightChart = .InsideHeight
End With
Set b = .Axes
With .Axes(xlCategory)
MinDate = .MinimumScale
MaxDate = .MaximumScale
End With
End With
'scale todays date on the x-axes to get postiion
XPos = ((Now() - MinDate) / (MaxDate - MinDate) * _
WidthChart) + LeftChart

Set dropline = ActiveSheet.Shapes.AddLine( _
XPos, TopChart, XPos, TopChart + HeightChart)
dropline.Line.DashStyle = msoLineRoundDot
dropline.Line.ForeColor.RGB = RGB(50, 0, 128)
dropline.Line.Weight = 3

.SendToBack
End With

End Sub


"Andy Pope" wrote:

Hi,

Like this?
http://www.andypope.info/ngs/ng25.htm

Cheers
Andy

Brenner wrote:
Each of my charts has about 60 days along the Y axis, and I would like the
senior manager to be able to see a dotted line that goes from the Y axis
(always from today's date) to the data point that represents today's value.

Is it possible to add a vertical series? Or to graph or draw a vertical line
that will "walk" along the Y axis?

Thanks!
John


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I draw a tangent line on a graph ? Tangent line placement Excel Discussion (Misc queries) 2 April 4th 23 02:20 PM
Draw a horizontal bar and line graph [email protected] Excel Discussion (Misc queries) 1 November 6th 08 09:40 AM
draw vertical line to mark today in diagram Florian Demmer Excel Discussion (Misc queries) 1 January 22nd 08 01:31 PM
How do i draw a regression line on a scatter graph tum tum Charts and Charting in Excel 1 May 19th 07 06:58 AM
Can I draw a tangent to a line in graph in Excel? J Heese Charts and Charting in Excel 1 September 2nd 06 02:41 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"