X-Y scatter plot axis range
X-Y scatter plot axis range
(OP)
Anybody know a good way to set the axis range limits of a scatter plot equal to values in a few cells?
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
X-Y scatter plot axis range
|
RE: X-Y scatter plot axis range
I could only get it to work on the y-axis. Here is the code I used though...
Sub ChangeAxis()
With Charts("Chart1").Axes(xlValue)
.MinimumScale = Worksheets("Sheet1").Range("A1")
.MaximumScale = Worksheets("Sheet1").Range("A2")
End With
End Sub
here the min value for the y-axis is in cell "A1", max value in "A2". I'm still trying to figure out the x-axis... If I figure it out, I'll let you know.
jproj
RE: X-Y scatter plot axis range
Sub ChangeAxis()
With Charts("Chart1").Axes(xlPrimary)
.MinimumScale = Worksheets("Sheet1").Range("A1")
.MaximumScale = Worksheets("Sheet1").Range("A2")
End With
With Charts("Chart1").Axes(xlSecondary)
.MinimumScale = Worksheets("Sheet1").Range("A3")
.MaximumScale = Worksheets("Sheet1").Range("A4")
End With
End Sub
xlPrimary changes the x-axis and xlSecondary changes the y-axis. (so Xmin = A1, Xmax = A2, Ymin = A3, and Ymax = A4)
I wasn't able to run the macro unless the chart was in it's own sheet, but I'm sure that's just a matter of referencing it correctly. (If you haven't already noticed, I haven't ever done this before).
Anyway, I hope this helps!
Jproj
RE: X-Y scatter plot axis range
Private Sub CommandButton1_Click()
With Worksheets("Sheet1").ChartObjects("Chart 1").Chart.Axes(xlCategory)
.MinimumScale = Worksheets("Sheet1").Range("A1")
.MaximumScale = Worksheets("Sheet1").Range("A2")
End With
With Worksheets("Sheet1").ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = Worksheets("Sheet1").Range("A3")
.MaximumScale = Worksheets("Sheet1").Range("A4")
End With
End Sub
Good Luck!
jproj
RE: X-Y scatter plot axis range
RE: X-Y scatter plot axis range
Sorry for all the worthless postings
jproj