View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
z.entropic z.entropic is offline
external usenet poster
 
Posts: 16
Default defining a variable-size worksheet area for charting

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 Whe=xlLocationAsObject, Name:="Data"

z.entropic