I'm trying to create a macro to rearrange and graph data.
I will be applying it to thousands of files that have different tab names based on the file name. I figured out that one may reference the tab via its 'Index Number' and that has worked when sorting the data.
Now that I am trying to create a line graph, I do not know how to reference the tab name. I'm trying to select the range. I changed it back to 'Sheet1' and was planning on changing the tab name of each file to 'Sheet1' before I learned of 'Index Number'.
Chart creating portion of the code:
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("'Sheet1'!$Z$2:$AA$25")
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "='Sheet1'!$C$1"
ActiveChart.SeriesCollection(1).Values = "='Sheet1'!$AA$2:$AA$25"
ActiveChart.SeriesCollection(1).XValues = "='Sheet1'!$Z$2:$Z$25"
ActiveChart.ApplyLayout (3)
I'm assuming that I want to replace all of the 'Sheet1's with some sort of Index Number. I tried random combinations of Sheets(1).