ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dynamic reference for chart (https://www.excelbanter.com/excel-programming/305843-dynamic-reference-chart.html)

Aja

dynamic reference for chart
 
Hello,

I want to export data from Excel, perform some calculations on it, and then link the data to an Excel chart. Although the exported data has a named range with it, the area where I've done calculations doesn't have a dynamic named range. It's the calculated area that I want my chart to reference. Does one have an example of code to share that makes my chart reference only the dimensions of the calculated area that correspond to the variable dimensions of the exported data? I'm sure it's some combination of the offset function. I just don't know exactly how to make it work.

Tom Ogilvy

dynamic reference for chart
 
On Possibility is
you can refer to a dynamic contiguous area by using the upper left corner
and CurrentRegion

set rng = Worksheets("NewSheet").Range("B9").CurrentRegion
If your chart is pre built, you can then create a named range for this
region and use the named range in your chart

rng.Name = "Data1"



--
Regards,
Tom Ogilvy

"Aja" wrote in message
...
Hello,

I want to export data from Excel, perform some calculations on it, and

then link the data to an Excel chart. Although the exported data has a
named range with it, the area where I've done calculations doesn't have a
dynamic named range. It's the calculated area that I want my chart to
reference. Does one have an example of code to share that makes my chart
reference only the dimensions of the calculated area that correspond to the
variable dimensions of the exported data? I'm sure it's some combination of
the offset function. I just don't know exactly how to make it work.




All times are GMT +1. The time now is 07:22 PM.

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