Prev: Toolbar is gone
Next: Time formula over two days
From: Tith on 21 May 2010 11:11 I'm working on a VBA macro that will chart multiple series of data. How do I tell the macro what range the series is on? I tried to do a record but that gives me a static range.
From: Don Guillett on 21 May 2010 11:41 As ALWAYS, post YOUR code for comments -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett(a)gmail.com "Tith" <Tith(a)discussions.microsoft.com> wrote in message news:64F571C0-FD81-4E03-B2DB-758BE77C0254(a)microsoft.com... > I'm working on a VBA macro that will chart multiple series of data. How do > I > tell the macro what range the series is on? I tried to do a record but > that > gives me a static range.
From: Tith on 21 May 2010 16:17 If myStartingPos = 0 Then myStartingPos = 44 myEndPos = 7378 myEndColPos = 36 Series_Name = "TC1" Chart_Name = "Unit 1" myActiveSheet = Sheets(1).Name End If Dim myRange As Range myRange = Range(Cells(myStartingPos, 3), Cells(myEndPos, 3)) Dim myXRange As Range myXRange = Range(Cells(myStartingPos, 1), Cells(myEndPos, 1)) ' Add the chart to the worksheet Charts.Add ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveChart.SetSourceData Source:=myRange, PlotBy:=xlColumns ActiveChart.SeriesCollection(1).XValues = myXRange ActiveChart.SeriesCollection(1).Name = Series_Name ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Chart " & Chart_Name With ActiveChart .HasTitle = True .ChartTitle.Characters.Text = Chart_Name .Axes(xlCategory, xlPrimary).HasTitle = True .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time (s)" .Axes(xlValue, xlPrimary).HasTitle = True .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Temperature (C)" End With ' Move the New Chart to the end Sheets("Chart " & Chart_Name).Select Sheets("Chart " & Chart_Name).Move After:=Sheets(2) Sheets(myActiveSheet).Activate End Sub "Don Guillett" wrote: > As ALWAYS, post YOUR code for comments > > -- > Don Guillett > Microsoft MVP Excel > SalesAid Software > dguillett(a)gmail.com > "Tith" <Tith(a)discussions.microsoft.com> wrote in message > news:64F571C0-FD81-4E03-B2DB-758BE77C0254(a)microsoft.com... > > I'm working on a VBA macro that will chart multiple series of data. How do > > I > > tell the macro what range the series is on? I tried to do a record but > > that > > gives me a static range. > > . >
|
Pages: 1 Prev: Toolbar is gone Next: Time formula over two days |