using visual basic to read until the last row of data in excel and display all into chart

i need to use a command where it is able to read until the last row of all my data and display them all into a line chart as i constantly need to insert new rows of data in and i do not wish to keep changing the row number of the chart... i have only managed to read and display the data until a specific row into the chart and so i hope to be able to find a easier way to do that by a click of a button...hope someone will be able to help me out... thanks

Answer this question

using visual basic to read until the last row of data in excel and display all into chart

  • MattGsy

    this is the code i am using

    ActiveSheet.ChartObjects("Chart 12").Activate
    ActiveChart.SeriesCollection(1).XValues = "=one!R2C1:R650C1"
    ActiveChart.SeriesCollection(1).Values = "=one!R2C3:R650C3"

    but this code only allow me to select up to a specific row and if i have more data rows then this, then i will have to change the numbers again... this is only for a chart and if i have many more, it will get worse


  • Jasper22

    Well what code are you using now

    ARe yoiu using the selction object to iterate through the rows

    Selection.Offset(0,1).Select...



  • using visual basic to read until the last row of data in excel and display all into chart