ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Range (https://www.excelbanter.com/excel-programming/302675-dynamic-range.html)

Tony Reflinski

Dynamic Range
 
In the following: ActiveChart.SetSourceData Source:=Sheets
("Sheet1").Range("E21:K21"), PlotBy _
:=xlRows
instead of Range("E21:K21")above,I want to assign range
based on currently selected cell as the begining of range
and nest 6 cell in the same row.

Please help

Norman Jones

Dynamic Range
 
Hi Tony,

Try:

Dim rng As Range

Set rng = ActiveCell.Resize(1, 6)

ActiveChart.SetSourceData Source:=rng, PlotBy:=xlRows



---
Regards,
Norman



"Tony Reflinski" wrote in message
...
In the following: ActiveChart.SetSourceData Source:=Sheets
("Sheet1").Range("E21:K21"), PlotBy _
:=xlRows
instead of Range("E21:K21")above,I want to assign range
based on currently selected cell as the begining of range
and nest 6 cell in the same row.

Please help




Norman Jones

Dynamic Range
 
Hi Tony,

Re-reading, you want a seven cell range, so replace

Set rng = ActiveCell.Resize(1, 6)

with

Set rng = ActiveCell.Resize(1, 7)


---
Regards,
Norman.


"Norman Jones" wrote in message
...
Hi Tony,

Try:

Dim rng As Range

Set rng = ActiveCell.Resize(1, 6)

ActiveChart.SetSourceData Source:=rng, PlotBy:=xlRows



---
Regards,
Norman



"Tony Reflinski" wrote in message
...
In the following: ActiveChart.SetSourceData Source:=Sheets
("Sheet1").Range("E21:K21"), PlotBy _
:=xlRows
instead of Range("E21:K21")above,I want to assign range
based on currently selected cell as the begining of range
and nest 6 cell in the same row.

Please help







All times are GMT +1. The time now is 01:21 PM.

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