View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mikerr mikerr is offline
external usenet poster
 
Posts: 1
Default how to select current range


Hi all,
While I'm comfortable with programming, I'm rusty and I have never see
VBA before.

I'm trying to make a macro that makes a graph with trendline based o
whatever range of numbers I have selected. I guess that means that i
the code below, I want to change the sheet and range references t
whatever is currently selected. Your answer will be appreciated.
Thanks.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("R
INT").Range("AC12:AC15")
ActiveChart.Location Whe=xlLocationAsObject, Name:="R1 INT"
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Trendlines.Add(Typ e:=xlLinear
Forward:=0, _
Backward:=0, DisplayEquation:=True
DisplayRSquared:=False).Select
ActiveChart.SeriesCollection(1).Trendlines(1).Data Label.Select
Selection.Left = 141
Selection.Top = 1
End Su

--
miker
-----------------------------------------------------------------------
mikerr's Profile: http://www.excelforum.com/member.php...fo&userid=2583
View this thread: http://www.excelforum.com/showthread.php?threadid=39219