Can't name the sheet with the chart!!!

jrnyman

Board Regular
Joined
Mar 10, 2002
Messages
105
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
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I'll just send this to the top of the list with a "is that a Euro symbol" comment....

Is that a Euro symbol ?

Maybe this will trigger something with the VBA experts....
 
Upvote 0
Yes indeed, that is a Euro symbol, but that can't be the problem as (a) it's just in the axis title as text" and (b) it's not the axis title that has the error, it's the chart title.

Any other ideas?
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,044
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top