I am using this small piece of code to format my chart so as to asjust the
min-max scale.
Sub FormatCharts()
On Error GoTo Err_Handler
shtPD.Activate
If (IsNumeric(shtCPD.Range("R6")) And IsNumeric(shtCPD.Range("R7")) And
_
IsNumeric(shtCPD.Range("T6")) And IsNumeric(shtCPD.Range("T7")))
Then
shtPD.ChartObjects("Chart 5").Activate
With ActiveChart.Axes(xlCategory)
.MinimumScale = shtCPD.Range("R6") ' gives error at this
line
.MaximumScale = shtCPD.Range("R7")
End With
With ActiveChart.Axes(xlValue)
.MinimumScale = shtCPD.Range("T6")
.MaximumScale = shtCPD.Range("T7")
End With
End If
' .......... and so on
The chart is placed in one of the sheets. I call the above sub on the
Worksheet_Change event when a particular condition is met. Sometimes, I get
the error "Out of memory" when I make some change in the sheet and the code
fails at the first line where I try to change the scale (the line)
.MinimumScale = shtCPD.Range("R6") ' gives error at this
line
I find nothing wrong on examining the value in R6.
I found the following ost from Tom, which talked about this error and charts
in general.
http://groups.google.com/group/micro...ing/browse_frm
/thread/eae7ca99666fc017/18808b12092efc93?q=%22out+of+memory%22&rnum=1&hl=en
#18808b12092efc93
-----------------------13. Tom Ogilvy Aug 25, 11:52 pm show options
Do you have the zoom set to 100% on all sheets? Not being at 100% was a
source for out of memory errors in xl97. Also, charts used to be
troublesome and it had something to do with font scaling - but I would think
the later SP would be more resiliant than the early one, but one never
knows.
--
Regards,
Tom Ogilvy
------------------------
Does anyone have any idea about why I should be getting such an error.
--
- Mangesh
------------------------------------------
Office 2003 & Windows XP
Bookmarks