Histogram Invalid Reference
in the vbe, Tools=References, select the analysis toolpak.
That would allow you to call Histogram like it was a built in function, but
since you are using application.Run, you shouldn't need a reference.
this kind of reference:
SourceData.Range(Cells(StartRow, 2),Cells(EndRow - 1, 2))
is inconsistent.
If in a general module:
If SourceData is the activesheet, it works, but then there is no reason to
have the qualifier SourceData. If SourceData isn't the activesheet, then
Range refers to the sourcedata sheet and Cells refers the activesheet and
raises an error.
With SourceData
Set HistData = .Range(.Cells(StartRow, 2),.Cells(EndRow - 1, 2))
End with
Would be consistent and avoid errors. There is a similar type problem if
the code is in a worksheet module in that the unqualified references refer to
the sheet that contain the code.
--
Regards,
Tom Ogilvy
" wrote:
Mike,
Thanks. I've got your stuff and it is very nice. I like to really
understand what I'm doing, so I'll likely dissect it and use parts of
it.
About the reference...the toolpak is loaded, but I'm not sure what you
mean by setting a reference. Would you please elaborate?
Thanks,
John
On Jul 28, 5:50 pm, "Mike Middleton" wrote:
John -
Maybe you haven't set a reference to the Analysis ToolPak add-in.
If you want to consider an alternative, look at my VBA code for a "Better
Histogram," available for download athttp://www.treeplan.com.
- Mikewww.MikeMiddleton.com
|