Change range name

A

Al Eaton

I have a series of dynamic range names (i.e.. PX1, PX2, PX3, PX4, ect). I
want to set up a loop to use each range name. I tried something like this
which does not work:


Dim RngNbr As Integer, iRow As Integer
RngNbr = 1
Sheets("HistData").Select
'Select range PX1, PX2, PX3, PX4 by changing the value of RngNbr
Set pxRge = Range("PX & RngNbr")

ActiveSheet.ChartObjects("Chart 41").Activate
With ActiveChart.Axes(xlValue)
.MinimumScale = 0.97 *
Application.WorksheetFunction.Min(pxRge)
.Crosses = xlCustom
.CrossesAt = 0
.ReversePlotOrder = False
.ScaleType = xlLinear
End With

Any ideas? I would also like the select different charts with a similar
method.
 
T

Tom Ogilvy

No obvious reason that shouldn't work. If you defined a name as PX1 in the
activeworkbook, then

i = 1
set rng = range("PX" & i)


should work fine.
 

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