Hi all,
I'm having serious issues trying to record macros to create graphs in my model. I used the macro recorder to go and select the data to create graphs in hopes that every time I change the data, the graphs would change with my vba code. However, every time I refresh the data it doesn't work and the source data for each graph says "#ref." How can I record/write code for graphs so that I can meet my desired goal.
I'm having serious issues trying to record macros to create graphs in my model. I used the macro recorder to go and select the data to create graphs in hopes that every time I change the data, the graphs would change with my vba code. However, every time I refresh the data it doesn't work and the source data for each graph says "#ref." How can I record/write code for graphs so that I can meet my desired goal.
Code:
Sub Macro1()'
' Macro1 Macro
' Macro recorded 7/18/2012
'
' Keyboard Shortcut: Ctrl+f
'
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("INFO").Range("A:A,G:G,H:H,I:I"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Correlations"
ActiveChart.HasDataTable = False
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).AxisGroup = 2
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ChartType = xlLine
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).AxisGroup = 2
ActiveChart.SeriesCollection(2).ChartType = xlLine
ActiveSheet.Shapes("Chart 15").IncrementTop -154.5
Windows("Project 1AA.xls").SmallScroll Down:=-21
ActiveSheet.Shapes("Chart 15").ScaleWidth 1.17, msoFalse, msoScaleFromTopLeft
ActiveChart.PlotArea.Select
Selection.Width = 515
ActiveChart.Legend.Select
Selection.Left = 35
Selection.Top = 191
Windows("Project 1AA.xls").SmallScroll Down:=-6
End Sub