locked
Add Charts to excel and change which data appear on that chart VBA RRS feed

  • Question

  • Hello!


    I have a Table and i want to add 2 chart.

             count      sum
    Apple      4        50
    Pie        10       5000
    Milk       50       6653211
    Cocoa      11       123456
    Bear       3        500
    Bread      7        87643
    
    'Workbooks(Output_AF_Name).Worksheets(s_wsName).Shapes.AddChart2(201, xlColumnClustered).Select
    'ActiveChart.SetSourceData Source:=Range("Sheet1!$F$1:$G$7")
    
    
    Workbooks(Output_AF_Name).Worksheets(s_wsName).Shapes.AddChart2(201, xlColumnClustered).Select
    ActiveChart.SetSourceData Source:=Range("Sheet1!$F$1:$H$7") 
    In the 2nd case i cant tell it to ignore the G column. With mouse is only a few "click" to deselect but the macro catched nothing.


    And i also need help with placeing it. I need to hide the F1:H7 range, so i want the 1st chart placed on top of that and the 2nd right under the 1st chart.

    Thank in advance


    I Hate Mondays


    Wednesday, April 8, 2020 1:26 PM

All replies

  • Hi,

    Considering the issue is mainly related to VBA, to help you resolve the issue better, I will move the thread to Excel for Developers. You may get more helpful replies there. Thanks for your kind understanding. 

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Best Regards,

    Emily


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Thursday, April 9, 2020 7:20 AM