Histogram in Excel

  • Thread starter Thread starter jtomdd
  • Start date Start date
J

jtomdd

I have written a macro that uses the data-analysis tool to creat a
histogram. It turns out too small and I have to manually enlarge it. I
can't seem to do it in the macro, because one has to select thee chart
and I can't figure out how to do this since it reuires a chart number
to select it. And of course the number changes every time the macro is
run.

So my question is: In a VBA macro how do I select the only chart when
I will not know it's number. Help will be appreciated. Thank you.
 
Hi,

Some like this will select the most recent chart object on the activesheet.


Dim objCht as ChartObject

set objCht = activesheet.chartobjects(activesheet.chartobjects.count)
objcht.width = 350
objcht.height = 250


Cheers
Andy
 
jtomdd -

If you do the resizing immediately after the chart is created, maybe you
could use ActiveChart to refer to it.

Instead of using the Histogram tool of the Analysis ToolPak, you may want to
investigate the VBA code of my free Better Histogram add-in, available from
http://www.treeplan.com.

- Mike
http://www.mikemiddleton.com
 
Back
Top