TO make secondary axis in pivot chart by Series Name

Vijay P
Vijay P used Ask the Experts™
on
Hi,

Excel Vba code need for to make secondary axis search by string (not full name of series name) if series name like "Seat No - 22",   then my condition like series name "Seat No"   irrespective of seat number like - 23 or 20,  if found my condition  in series name  then  change to secondary axis  in pivot chart.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Hi,

pls try
Sub macro()

Set ch = ActiveSheet.ChartObjects(1).Chart
For Each ser In ch.SeriesCollection
    If ser.Name Like "Seat No*" Then
        ser.AxisGroup = xlSecondary
    End If
Next
End Sub

Open in new window

Regards

Author

Commented:
Thank you so much... That's work perfect.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial