ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   defining a variable-size worksheet area for charting (https://www.excelbanter.com/excel-worksheet-functions/154288-defining-variable-size-worksheet-area-charting.html)

z.entropic

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



All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com