random_noise
Active Member
- Joined
- Dec 19, 2007
- Messages
- 367
I've got a macro which automatically inputs data from a text file & splits it up into chunks and basically creates a seperate sheet for each chunk (which represents a days worth) of data.
What Im now trying to do is have a chart automatically created with the data and created as a new sheet.
The number of rows in the chart can vary so I'm having difficulty automatically selecting the correct range for the chart source data.
I'm really not sure how the whole range function works but I'm sure there must be a way to automatically select all the data up to where there is no more quickly & easily.
At the moment the (non-working) code I have is:
I think I'm going about this completely wrong.
I basically need to select from B1:C{whatever} as my source data. Normally there are 1000s of rows so I'd rather not have to use some kind of counter to work out where the last row is.
Any ideas where I'm going wrong (apart from everywhere!)?
Cheers
Dave
What Im now trying to do is have a chart automatically created with the data and created as a new sheet.
The number of rows in the chart can vary so I'm having difficulty automatically selecting the correct range for the chart source data.
I'm really not sure how the whole range function works but I'm sure there must be a way to automatically select all the data up to where there is no more quickly & easily.
At the moment the (non-working) code I have is:
Code:
Range("B1").Select
Set chartrange = Sheets(varsheetname).Range(ActiveCell, ActiveCell.End(xlDown))
' test add in chart
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Sheets(varsheetname).Range(chartrange), _
PlotBy:=xlColumns
I basically need to select from B1:C{whatever} as my source data. Normally there are 1000s of rows so I'd rather not have to use some kind of counter to work out where the last row is.
Any ideas where I'm going wrong (apart from everywhere!)?
Cheers
Dave