With Excel VBA: Reorganizing the Plot Order on a chart by legend name, not number

I need to re-position the series in a chart based on the values of the series. The values to be sorted have corresponding series/legend names in Column B.So instead of moving the series up and down like this:
ActiveChart.SeriesCollection(4).PlotOrder = 1

Open in new window

I need to be able to specify the plot order of each series based on its name like this:  
ActiveChart.SeriesCollection(Series Name).PlotOrder = 1

Open in new window

Dim top As Range, btm As Range, topRw As Long, btmRw As Long, SrzNm As String
Set top = [B1].End(xlDown)
Set btm = top.End(xlDown)
topRw = top.Row - (top.Row - 1)
btmRw = btm.Row - [B1].End(xlDown).Row + 1
For i = topRw To btmRw
SrzNm = Cells(top.Row + i - 1, 2)
'ActiveChart.SeriesCollection(the PlotOrder number of the series collection named "SrzNm").PlotOrder = i
Next ii

Open in new window

How would I write line 8 so that the PlotOrder of the series collection with the name of SrzNm would be the value of i?

Is this enough info?

John CarneyReliability Business Tools Analyst IIAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


you can use the Series name in your code

ActiveChart.SeriesCollection("Series5").PlotOrder = 1

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John CarneyReliability Business Tools Analyst IIAuthor Commented:
Thanks, Rgonzo. I tried that  - or what I thought was that! - before and it didn't work. Thank you for making me try it again.

~ John
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.