Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Ok I guess I will use my workaround in this case. But it is not th best solution. Here is the code when it works. Sub SetYScaleAllNew(AutoScale As Boolean, YMax As Long, YMin As Long) Dim myChartCollection As ChartObjects numChart = Worksheets("All").ChartObjects.Count '<<< this gives me tha there are 6 of them Set myChartCollection = Worksheets("All").ChartObjects For i=1 to numChart With myChartCollection(i).Chart If (AutoScale = False) Then .Axes(2, xlPrimary).CrossesAt = YMin .Axes(2, xlPrimary).MaximumScale = YMax .Axes(2, xlPrimary).MinimumScale = YMin .Axes(2, xlPrimary).MajorUnit = Abs(YMax - YMin) / 10 .Axes(2, xlPrimary).MaximumScaleIsAuto = False .Axes(2, xlPrimary).MinimumScaleIsAuto = False Else .Axes(2, xlPrimary).MajorUnitIsAuto = True .Axes(2, xlPrimary).MaximumScaleIsAuto = True .Axes(2, xlPrimary).MinimumScaleIsAuto = True .Axes(2, xlPrimary).CrossesAt = .Axes(2, xlPrimary).MinimumScale End If End With Next i End Sub Let me know if you found how to fix the problem. P.S. I still can't get EnableEvents to work, and it slows my whol program down -- Intellihom ----------------------------------------------------------------------- Intellihome's Profile: http://www.msusenet.com/member.php?userid=147 View this thread: http://www.msusenet.com/t-187057402 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
Would a loop work? | Excel Programming | |||
Why doesn't my loop work? | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |