vba min,max

Moizsaif123
Moizsaif123 used Ask the Experts™
on
Im getting an error in setting the min and max for the Y-axis for a vba excel chart and am attaching a screenshot for showing the error im receiving while running this macro..

With ActiveChart.ChartObjects("Chart5").Axes(xlCategory)
                        .MinimumScale = 20
                        .MaximumScale = 90
                    End With
                    

Open in new window


Basically this code was implemented throught this link

http://peltiertech.com/Excel/Charts/AxisScaleLinkToSheet.html
error.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chris RaisinRetired Senior Systems Analyst/Programmer

Commented:
When you click "Debug" which line is highlighted in your code?

Cheers
Chris
I am sorry, I found the solution for this, as code posted below for y-axis.

With ActiveChart.Axes(xlValue)
                 .MaximumScale = 90
                 .MinimumScale = 20
        End With

Open in new window

Author

Commented:
solution found for this

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial