View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Diane Diane is offline
external usenet poster
 
Posts: 96
Default Creating a Macro to Chart two columns

I have the following spreadsheet:

A B C D
1 Date Amt Spent Cumm Amt Budget
2 1/10 100 100 1000
3 1/20 50 150 1000
4 1/30 75 225 1000
5 2/10 100 325 1000

Where Budget (Column D) will always be the same value, and Column C is the
cummulative value of B. I am desperately trying to create a macro where it
will line plot column C & D against column A, BUT, the trick is that
sometimes there are 5 rows, sometimes there are 16, sometimes there are 20
etc etc etc.

I found this to start with, but need a little help getting this tweaked for
my needs.

Sub Macro1()
'
Dim rng As Range
Dim ws As Worksheet
'
Set rng = ActiveCell.Range("A1:O1")
Set ws = ActiveSheet
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData _
Source:=rng, PlotBy:=xlRows
ActiveChart.Location Whe=xlLocationAsObject, _
Name:=ws.Name
ActiveChart.HasLegend = False
End Sub

Any guidance would be greatly appreciated