I am brand new VBA as well as your group and am hoping you can help
me. I would like my macro to reference a successive cell range each
time it is run. For example I have figures in A1:A5 which represent
Jan-May, and a chart pulling those figures. I always want my chart
to reference the last five months so when I add new figures to the
spreadsheet and run the marco I would like it to pull A2:A6 and so
on each month. I am sure there is a simple way to modify the code.
Any assistance you can offer is much appreciated. I have attached
what I have so far...
Rows("69:69").Select
Selection.Insert Shift:=xlDown
Range("A69").Select
ActiveCell.FormulaR1C1 = _
"=TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,1),""mmm-yy"")"
Range("A69").Select
Selection.Copy
Range("A69").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A69").Select
ActiveSheet.ChartObjects("Chart 9").Activate
ActiveChart.ChartArea.Select
ActiveWindow.Visible = False
Windows("2008 Oct Month End.xls").Activate
Range("B71").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(R[-2]C-R[-3]C)"
Range("B71").Select
Selection.AutoFill Destination:=Range("B71:O71"),
Type:=xlFillDefault
Range("B71:O71").Select
Range("Q71").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-2]C-R[-3]C)"
Range("P71").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1]/RC[1])"
Range("P72").Select
ActiveWindow.SmallScroll ToRight:=-10
ActiveSheet.ChartObjects("Chart 9").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(1).Values = "='Payor Mix'!
R65C4:R69C4"
ActiveChart.SeriesCollection(2).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(2).Values = "='Payor Mix'!
R65C5:R69C5"
ActiveChart.SeriesCollection(3).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(3).Values = "='Payor Mix'!
R65C7:R69C7"
ActiveChart.SeriesCollection(4).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(4).Values = "='Payor Mix'!
R65C8:R69C8"
ActiveChart.SeriesCollection(5).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(5).Values = "='Payor Mix'!
R65C9:R69C9"
ActiveChart.SeriesCollection(6).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(6).Values = "='Payor Mix'!
R65C10:R69C10"
ActiveChart.SeriesCollection(7).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(7).Values = "='Payor Mix'!
R65C11:R69C11"
ActiveChart.SeriesCollection(8).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(8).Values = "='Payor Mix'!
R65C12:R69C12"
ActiveChart.SeriesCollection(9).XValues = "='Payor Mix'!
R65C1:R69C1"
ActiveChart.SeriesCollection(9).Values = "='Payor Mix'!
R65C14:R69C14"
Windows("2008 Oct Month End.xls").SmallScroll ToRight:=-4
End Sub