ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to speed up response to scaling axes with code? (https://www.excelbanter.com/excel-programming/387744-how-speed-up-response-scaling-axes-code.html)

[email protected]

How to speed up response to scaling axes with code?
 
I am programming a chart building worksheet with vb, and I must scale
the axes based on a value within my spreadsheet. Right now, I am
using the following commands:

With ActiveChart.Axes(xlValue, xlPrimary)

.MinimumScale = Worksheets("Aux").Range("M15")
.MaximumScale = Worksheets("Aux").Range("M14")
.MajorUnitIsAuto = True
.MinorUnitIsAuto = True

End With

and doing this for each of the Primary, Secondary, and Category axes.
However, with 32,000 data points and 8 to 16 series, this takes
forever. Aside from just using a splash screen to help the user pass
the time, does anyone have any suggestions on how to speed this up or
how to do this a better way? Thanks!


Jon Peltier

How to speed up response to scaling axes with code?
 
This won't help so much with Excel 2007, but in any Excel version, it should
improve matters to construct your code like this:

Application.ScreenUpdating = False
With ActiveChart.Axes(xlValue, xlPrimary)

.MinimumScale = Worksheets("Aux").Range("M15")
.MaximumScale = Worksheets("Aux").Range("M14")
.MajorUnitIsAuto = True
.MinorUnitIsAuto = True

End With

Application.ScreenUpdating = True

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


wrote in message
ups.com...
I am programming a chart building worksheet with vb, and I must scale
the axes based on a value within my spreadsheet. Right now, I am
using the following commands:

With ActiveChart.Axes(xlValue, xlPrimary)

.MinimumScale = Worksheets("Aux").Range("M15")
.MaximumScale = Worksheets("Aux").Range("M14")
.MajorUnitIsAuto = True
.MinorUnitIsAuto = True

End With

and doing this for each of the Primary, Secondary, and Category axes.
However, with 32,000 data points and 8 to 16 series, this takes
forever. Aside from just using a splash screen to help the user pass
the time, does anyone have any suggestions on how to speed this up or
how to do this a better way? Thanks!




David G[_4_]

How to speed up response to scaling axes with code?
 
On Apr 19, 9:52 am, wrote:
Right now, I am
using the following commands:

With ActiveChart.Axes(xlValue, xlPrimary)

.MinimumScale = Worksheets("Aux").Range("M15")
.MaximumScale = Worksheets("Aux").Range("M14")
.MajorUnitIsAuto = True
.MinorUnitIsAuto = True

End With

and doing this for each of the Primary, Secondary, and Category axes.


Are you sure that scaling the axis is indeed the issue here, rather
than the amount of data that excel has to lay-out?
Maybe scaling the axes before setting the data for the chart would
help improve the performance, if scaling is indeed the issue.

David




All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com