defining a variable-size worksheet area for charting

Z

z.entropic

How to define a variable-size area in a time-series chart-creating macro that
would include all the data in a worksheet, starting for example from cell B6?
RyGuy suggested using

Sub Ender()
Range("B6").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
End Sub

but how to include these values in the chart-creating code instead of the
direct "B6:E100" address in the example given below?

Sheets("Data").Select
Range("B6").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Data").Range("B6:E100")
ActiveChart.Location Where:=xlLocationAsObject, Name:="Data"

z.entropic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top