Macro to determine min/max values of column

F

Fan924

I need a macro to set min & max values for a chart. The macro should
search a data column to determine the min & max values. I can handle
setting the chart but am a little vague one determining the min & max
values. Excel97
 
P

Patrick Molloy

With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = Range("F7")
.MaximumScale = WorksheetFunction.Max(Range("E10:E1000"))
End With


here, F7 is a cell with the MIN() function. I like this because you can also
show max and/or min specifically on the chart if the values are on the sheet
 
F

Fan924

Thanks guys. I was really stuck.I made some small changes to Patrick's
code:

Sub TestChart1()
With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlValue)
.MinimumScale = WorksheetFunction.Min(Range("B3:B17"))
.MaximumScale = WorksheetFunction.Max(Range("B3:B17"))
End With
End Sub

Instead of using Range("B3:B17"), I would like to read the current Y-
axis range and use that instead. Any ideas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top