Hi guys, i am new to this forum, hope you guys can help me, i have a basic question to ask, what is the correct code for the values so that i can get the full range of data. Because in the example below i only know how to put the range from 1 to 9, i need the code that allows me to plot the graph regardless of how many data i have.

ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Rating"""
ActiveChart.SeriesCollection(1).Values = "='Sheet1'!$B$2:$B$9"
ActiveChart.SeriesCollection(1).XValues = "='Sheet1'!$A$2:$A$9"

Thank you guys in advance