dynamic reference for chart

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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 said:
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.
 

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

Back
Top