Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excell VBA value axis(y) scale manipulation 1

Status
Not open for further replies.

DataHugger

Programmer
May 26, 2004
38
US
I wish to limit the number of values that appear on the side of the scale to three. I have seen many differnt ways to alter the value of a scale using VBA but I have found no way to limit the number of values that display.

Problem Description:
I have create a function that dynamically creates chart based on what worksheet in the workbook it is accessing.
I create four charts per worksheet. I am useing a function that selects different parts of the table and and generates a graph. I have now formated all the chart the way I want except for the scale. I want the automax displayed and two values inbetween 0 and the max to be displayed.

Does anyone know how to limit the value axis in this way?

Thanks again in advance.

-DataHugger

sorry if my quesiont was spastic.
 
DataHugger,

Please post a sample of your data, the type of chart you are generating and the exact results you expect to be displayed.

Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Just offhand I'd say that the on the Value Axis scale
Code:
    With ActiveChart.Axes(xlValue)
        .MinimumScale = MinVal
        .MaximumScale = MaxVal
        .MajorUnit = (MaxVal - MinVal)/2
    End With


Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Thank you both. This is my final code snippet.
I put minimum scale in there incase somebody wants to use it for a more robust purpose.

Code:
     With ActiveChart.Axes(xlValue)
        .MaximumScaleIsAuto = True
        .MinimumScale = 0
        .MajorUnit = (.MaximumScale - .MinimumScale) / 3
    End With

I would have never known that I could use axes properties as variables. Thanks alot.

-DataHugger
 
I'm glad we BOTH could help. I assure you that I consulted with him at length. He ALSO send his appreciation.

Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
OOPS. I was hoping you didn't catch that.

[blush]

DataHugger learned his lesson and has started to preview his posts before he submits them.
 
[rofl]

Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top