learning2fly
Programmer
Hello,
I have recently had a rather strange problem running code to insert charts.
The problem originally started as a memory problem. I am creating about 36 charts from a large amount of data and pasting these in a new worksheet.
Up to a point this ran no problem, but with a larger amount of data (and graphs) I got a 'Not enough memory' message and the program crashes.
To combat this I added the line
Application.ScreenUpdating = False
This allowed the program to run to completion but the chart title formatting no longer worked. The code for this updating is shown below:
ActiveSheet.ChartObjects("Chart" + Str(n + 1)).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
I don't understand why this should stop working because of the screen updating line but this is all that I changed.
I would be happy with a solution to either the memory problem or the updating titles problem as I think either will give the outcome I need.
Thanks in advance
Gordon
I have recently had a rather strange problem running code to insert charts.
The problem originally started as a memory problem. I am creating about 36 charts from a large amount of data and pasting these in a new worksheet.
Up to a point this ran no problem, but with a larger amount of data (and graphs) I got a 'Not enough memory' message and the program crashes.
To combat this I added the line
Application.ScreenUpdating = False
This allowed the program to run to completion but the chart title formatting no longer worked. The code for this updating is shown below:
ActiveSheet.ChartObjects("Chart" + Str(n + 1)).Activate
ActiveChart.ChartTitle.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
I don't understand why this should stop working because of the screen updating line but this is all that I changed.
I would be happy with a solution to either the memory problem or the updating titles problem as I think either will give the outcome I need.
Thanks in advance
Gordon