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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with chart x axis scale

Status
Not open for further replies.

sedgely

Technical User
Feb 21, 2002
406
GB
i have the following that changes the x axis scale based on a value on a worksheet, it works fine until i change
Code:
[red]With ActiveChart.Axes(xlCategory)[/red]
            .MinimumScale = minScaleValue
            .MaximumScale = maxScalevalue
        End With
to
Code:
[red]With oSPCCht.Axes(xlCategory)[/red]
            .MinimumScale = minScaleValue
            .MaximumScale = maxScalevalue
        End With
can someone explain why this won't work?

Code:
Function updateSPCcht()

Dim minScaleValue 
Dim maxScalevalue 
Dim oDataSh As Worksheet
Dim oSPCCht As ChartObject


Set oDataSh = Worksheets("Page1 SPC")
Set oSPCCht = Worksheets("printsheet").ChartObjects("SPC Chart 1")
maxScalevalue = oDataSh.Range("j1").Value
minScaleValue = maxScalevalue - 196

[red]With ActiveChart.Axes(xlCategory)[/red]
            .MinimumScale = minScaleValue
            .MaximumScale = maxScalevalue
        End With
End Function

Cheers, Craig
Si fractum non sit, noli id reficere
 
try this:

Code:
 Set oSPCCht = Worksheets("printsheet").ChartObjects("SPC Chart 1").select
 




Hi,

Code:
Dim oSPCCht As [b]ChartObject[/b]


Set oDataSh = Worksheets("Page1 SPC")
Set oSPCCht = Worksheets("printsheet").ChartObjects("SPC Chart 1")
maxScalevalue = oDataSh.Range("j1").Value
minScaleValue = maxScalevalue - 196
[b][red]
'a ChartObject is not a Chart[/red]
[/b]
With oSPCCht[b].Chart[/b].Axes(xlCategory)
            .MinimumScale = minScaleValue
            .MaximumScale = maxScalevalue
        End With

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Guys

Thx for the reponses. Skip, can't believe i didn't spot that, DOH!

Cheers, Craig
Si fractum non sit, noli id reficere
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top