Is there some reason why everytime I get to the line that names a new sheet for a chart I get some error that immediately ends the sub-routine? No dialog box or anything; it just skips the rest of the routine and exits the Sub. Here's the code:
Selection.Activate
Charts.Add
ActiveChart.ChartType = xl3DArea
ActiveChart.SetSourceData Source:=Sheets("WIP2").Range("B" & LastRow + 1 & ":" & RightFill), PlotBy:= _
xlRows
ActiveChart.SeriesCollection(1).XValues = "=WIP2!R1C2:R1C50"
If LoanBorrow = "LOANS" Then
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Monthly Average Loans" 'Right here it breaks off
ElseIf LoanBorrow = "BORROWS" Then
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Monthly Average Borrows"
End If
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.text = "Average Monthly Nominals For " & Client & " For The Past " & MnthAvgCount & " Months"
.Axes(xlCategory).HasTitle = False
.Axes(xlSeries).HasTitle = False
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Characters.text = "Average Nominals (€000)"
End With
Selection.Activate
Charts.Add
ActiveChart.ChartType = xl3DArea
ActiveChart.SetSourceData Source:=Sheets("WIP2").Range("B" & LastRow + 1 & ":" & RightFill), PlotBy:= _
xlRows
ActiveChart.SeriesCollection(1).XValues = "=WIP2!R1C2:R1C50"
If LoanBorrow = "LOANS" Then
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Monthly Average Loans" 'Right here it breaks off
ElseIf LoanBorrow = "BORROWS" Then
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Monthly Average Borrows"
End If
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.text = "Average Monthly Nominals For " & Client & " For The Past " & MnthAvgCount & " Months"
.Axes(xlCategory).HasTitle = False
.Axes(xlSeries).HasTitle = False
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Characters.text = "Average Nominals (€000)"
End With