Converting a recorded Macro into a Generic One
Posted by Michael Jaye on December 11, 2001 11:18 AM
I recorded the following macro for plotting line charts to start from zero, however, the data range is fixed, how can I convert this into vba code where the data range is not fixed.
Sub Test()
'Test Macro - Name of Macro
Range("A1").Select
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Select
ActiveCell.FormulaR1C1 = "Start"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:E14"), PlotBy _
:=xlColumns
ActiveWindow.Visible = False
Windows("LineChartZeroStart.xlt").Activate
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.ClearContents
End Sub
Appreciate any suggestions.
Thanks