locked
Deleting a Specific Excel Chart RRS feed

  • Question

  • User-1861919626 posted

    Hi guys...I am needing to delete a chart on Excel spreadsheet.  However, I only want to delete the one titled Chart 232.  How can I specify which chart to delete and not use

    foreach (Shape shp in Excel.Application.Sheets["Sheet 1"].Shapes)
    
    {
    
    if (shp.Type == MsoShapeType.msoChart)
    
    {
    
    shp.Delete();
    
    }
    
    }
    
    



    Tuesday, July 9, 2013 3:13 PM

Answers

  • User-1910946339 posted

    I'm not sure why you would ask an ASP.Net forum about Excel (I would have thought an Excel programming forum was likely to give more accurate answers).

    But, I can answer all your Excel questions in one go. 

    1) Click on the Developer tab

    2) Click on Record Macro

    3) Click OK in the dialog box

    4) Do whatever it is you want to know how to write a program for

    5) Click the 'Stop Recording' button in the status bar

    6) Press Alt-F11

    7) Use the navigation pane on the left to open Module 1

    8) Read Macro1

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 9, 2013 10:31 PM