Hello,
I receive a workbook via 3rd party containing graphs within each sheet. The workbook may contain a different number of sheets per file.
I would like to write a macro to go through each sheet in the workbook (except for sheets 1 and 2), and change the name of the series to "Total Membership". Code I've tried to write is as such:
Sub Change ()
Dim ws As Worksheet
Workbooks.Open [NameofFile]
Application.Scr eenUpdating = False
For Each ws In ActiveWorkbook. Sheets
ActiveSheet.Cha rtObjects("Char t 1").Activate
ActiveChart.Plo tArea.Select
Application.Cut CopyMode = False
ActiveChart.Ser iesCollection(3 ).Name = "=""Total_Membe rship"""
ActiveWindow.Vi sible = False
If ws.Index <> 1 And ws.Index <> 2 Then ws.Select False
Next ws
End Sub
This code appears to go through each sheet in the file, but will only change the name of the first chart (in sheet 3), and do nothing to any other chart.
Yes, I am a novice... so any help would be appreciated!!!
Thank you,
Matt
Application.Scr eenUpdating = True
I receive a workbook via 3rd party containing graphs within each sheet. The workbook may contain a different number of sheets per file.
I would like to write a macro to go through each sheet in the workbook (except for sheets 1 and 2), and change the name of the series to "Total Membership". Code I've tried to write is as such:
Sub Change ()
Dim ws As Worksheet
Workbooks.Open [NameofFile]
Application.Scr eenUpdating = False
For Each ws In ActiveWorkbook. Sheets
ActiveSheet.Cha rtObjects("Char t 1").Activate
ActiveChart.Plo tArea.Select
Application.Cut CopyMode = False
ActiveChart.Ser iesCollection(3 ).Name = "=""Total_Membe rship"""
ActiveWindow.Vi sible = False
If ws.Index <> 1 And ws.Index <> 2 Then ws.Select False
Next ws
End Sub
This code appears to go through each sheet in the file, but will only change the name of the first chart (in sheet 3), and do nothing to any other chart.
Yes, I am a novice... so any help would be appreciated!!!
Thank you,
Matt
Application.Scr eenUpdating = True
Comment