View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] eyelynch@gmail.com is offline
external usenet poster
 
Posts: 3
Default using macros to chart data

Here's the Macro

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 7/23/2007 by Tudor
'
' Keyboard Shortcut: Ctrl+u
'
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("B111:B145"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "='Japan LongShort
Index'!R3C2:R92C2"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R110C2:R145C2"
ActiveChart.SeriesCollection(1).Name = "=Sheet1!R1C2"
ActiveChart.SeriesCollection(2).XValues = "='Japan LongShort
Index'!R3C2:R92C2"
ActiveChart.SeriesCollection(2).Values = "='Japan LongShort Index'!
R3C3:R92C3"
ActiveChart.SeriesCollection(2).Name = "=""Japan L/S Index"""
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet2"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "788 Japan Ltd"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Monthly
Return"
End With
ActiveSheet.Shapes("Chart 1").IncrementLeft -117#
ActiveSheet.Shapes("Chart 1").IncrementTop -93#
ActiveWindow.Visible = False
Windows("Performance data.xls").Activate
Range("C20").Select
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("C110:C145"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "='Japan LongShort
Index'!R3C2:R92C2"
ActiveChart.SeriesCollection(1).Values = "=Sheet1!R110C3:R145C3"
ActiveChart.SeriesCollection(1).Name = "=Sheet1!R1C3"
ActiveChart.SeriesCollection(2).XValues = "='Japan LongShort
Index'!R3C2:R92C2"
ActiveChart.SeriesCollection(2).Values = "='Japan LongShort Index'!
R3C3:R92C3"
ActiveChart.SeriesCollection(2).Name = "=""Japan L/S Index"""
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet2"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "A.I. Equity Hedge Fund"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Monthly
Return"
End With
End Sub



The start date of the data series vary. It's performance numbers. So
they all tend to end around the same date but start at different
dates. The first two in the example above started in January 2005 and
I have others that start in 1996. I have the data arranged in columns
in ascending order from earliest date to latest. The very top column
has the name of the series and below that (depending on the start date
of the series) are the data series.



On Jul 23, 11:02 am, Joel wrote:
Post the macro. It can be modified. The recorded macros only refer to the
cells you recorded, but it is easy to xpand the macro for a more general
case. Record a macro for two charts so we can see the diferences and the we
can expand the macro properly to work for all 200 series. Explain how the
200 series are different.



" wrote:
I have a sheet containing over 200 series of data and I want to chart
each one separately while comparing them to a benchmark data series
within another sheet. Is there a way I can run a macro instead of
doing this manually? I tried to construct a macro myself and was only
able to duplicate what was recorded. I know there is a way. Please
help.- Hide quoted text -


- Show quoted text -