SquareHouse
New Member
- Joined
- Apr 26, 2021
- Messages
- 4
- Office Version
- 365
- 2019
- Platform
- Windows
I have a macro that goes through all the charts in my workbook and changes the series inputs (in this case would change row 18 reference to row 19 but can obviously be amended as needed)
I'd like to amend this macro so that I can just amend the charts in my selection instead of the entire workbook
I know this must be an easy fix, but haven't had any luck in getting my tries to work
Thanks in advance
I'd like to amend this macro so that I can just amend the charts in my selection instead of the entire workbook
I know this must be an easy fix, but haven't had any luck in getting my tries to work
Thanks in advance
VBA Code:
sub changeallcharts()
Dim sht As Worksheet
Dim cht As ChartObject
Dim ser As Series
For Each sht in ActiveWorkbook.worksheets
For Each cht in sht.ChartObjects
For Each ser In cht.Chart.SeriesCollection
ser.formula = replace(ser.Formula, "$18","$19")
Next ser
Next cht
Next sht
MsgBox("All Done")
end sub