Macro to delete "series" in a chart

excel_2009

Active Member
Joined
Sep 14, 2009
Messages
318
Hi Excel gurus,

Quick question, how can i delete the "series" key from an excel chart? :)

i'm using the current coding to move the actual graph, but was wondering if its possible to delete the "series":

Code:
Set chtObj = ActiveSheet.ChartObjects(1)
chtObj.Left = Cells(32, 1).Left
chtObj.Top = Cells(32, 1).Top
chtObj.Legend.Select

Thank you! :)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi Andrew,

Thank you for helping, an error message appears when i run the code:

Object variable or With Block variable not set?

but the coding does work:biggrin:! is there anyway i can disable the above message from appearing?! :confused:
 
Upvote 0
I got no error with this code:

Code:
Sub Test()
    Dim chtObj As ChartObject
    Set chtObj = ActiveSheet.ChartObjects(1)
    chtObj.Left = Cells(32, 1).Left
    chtObj.Top = Cells(32, 1).Top
    chtObj.Chart.HasLegend = False
End Sub

provided that a cell was active when I ran it.
 
Upvote 0
Thank you Andrew it works perfectly, by the way is it possible to adapt that macro so that it deletes the entire chart? :)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top