View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.charting
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Excel 2007, log chart issue

In a very simple line chart with one series having one negative value, when
I manually set the scale to logarithmic, I got the error the first time, but
not subsequent times. It's as if Excel remembered it had already bothered me
about this. Despite the warning, the axis was changed. When I created a new
chart (which I had not been warned about) and used the VBA code, I got the
error; after clearing the error, the axis was changed. However, you want to
avoid the error. I tried EnableEvents:

Sub LogScale()
Application.DisplayAlerts = False
ActiveChart.Axes(xlValue).ScaleType = xlLogarithmic
Application.DisplayAlerts = True
End Sub

but it did not prevent the message. I don't know what to suggest, but I'm
waiting to see what others may have to say.

I was using Excel 2007 SP1, as if it matters.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"Newsx" wrote in message
...

I'm trying to put together a piece of code in Excel, to be called by an
external application to regenerate graphs.

The offending code is this:

ActiveChart.PlotVisibleOnly = True
ActiveChart.DisplayBlanksAs = xlNotPlotted
ActiveChart.Axes(xlValue).ScaleType = xlLogarithmic


The process fails when trying to set the scaletype to logarithmic,
claiming that negative or zero values cannot be plotted.

There are no negative or zero values in the data series but there are a
number of blank cells. This works perfectly in Excel 2003 but Excel 2007
throws errors.

This is really doing my head in, so any pointers would be much
appreciated!


--
Confidence is what you have when you don't understand the situation