#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default macro chart creation

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default macro chart creation

As ALWAYS, post YOUR code for comments

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tith" wrote in message
...
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.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default macro chart creation

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 Whe=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

"Tith" wrote in message
...
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.


.

Reply
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
Macro creation Ojunera Excel Worksheet Functions 0 October 6th 08 06:28 PM
Macro creation Xavier[_2_] Excel Worksheet Functions 1 May 14th 08 04:43 AM
Chart creation Harddrive747 Charts and Charting in Excel 2 October 23rd 06 03:17 AM
Creation of macro with an example Jothirmaya Excel Discussion (Misc queries) 2 November 30th 05 12:10 AM
Macro Creation Programming Cells Excel Discussion (Misc queries) 3 July 28th 05 06:07 PM


All times are GMT +1. The time now is 12:16 PM.

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

About Us

"It's about Microsoft Excel"