How do I keep the previous graph generated by the formula ("=rand()") when I hit the f9 button. As we know, the graph updates itself everytime you hit f9 but I wish to keep the previous graphs that was produced and also the current graph after hitting f9. Here is my code:
Private Sub Worksheet_Calculate()
Sheets("Chart1").Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = ActiveSheet.Range("b1:b20")
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Dim arrayinputs(0 To 20) As Long
Dim arraynum(0 To 10) As Integer
Dim i As Integer
Charts.Add
ActiveChart.Name = "Chart1"
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("B1:B20"), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R1C1:R20C1"
ActiveChart.Location Where:=xlLocationAsNewSheet
ActiveChart.HasDataTable = False
EnableCalculation = True
End Sub
Private Sub Worksheet_Calculate()
Sheets("Chart1").Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values = ActiveSheet.Range("b1:b20")
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Dim arrayinputs(0 To 20) As Long
Dim arraynum(0 To 10) As Integer
Dim i As Integer
Charts.Add
ActiveChart.Name = "Chart1"
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("B1:B20"), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R1C1:R20C1"
ActiveChart.Location Where:=xlLocationAsNewSheet
ActiveChart.HasDataTable = False
EnableCalculation = True
End Sub