I have 25 spreadsheets that have pie charts. I need to loop through the spreadsheets and change where the pie charts get the information from. But I can't get the code to work. I am coming from this:
Sub ChangePieValues()
Dim sheetno As Integer
sheetno = 14
Sheets(sheetno).Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.FullSeriesCollection(1).XValues = "=Worksheets(2)$BA$3:$BA$6"
ActiveChart.FullSeriesCollection(1).Values = "=Worksheets(2)$BB$3:$BB$6"
End Sub
I haven't added the loop yet as this is the easy part.
My problem is in the following line:
ActiveChart.FullSeriesCollection(1).XValues = "=Worksheets(2)$BA$3:$BA$6"
I thought I could write something like:
ActiveChart.FullSeriesCollection(1).XValues = "=Worksheets(2).((Range(55,3)):(Range(55,6))"
I am trying to change the Range of the XValues to a number so I can change that number as I go through the different spreadsheets.
How can I change the way I input the column index, so it can be changed by loops.