findBoundingBox macro takes range of x coordinates, range of y coordinates, and range of id coordinates as parameters.
The macro will create a new worksheet that displays the points of a bounding shape that encompasses all points from the passed (x,y) params.
A picture is worth a thousand words:
red series found by using
findBoundingBox macro - sample app can be downloaded at sample/bounding-box.xlsm
This is a quick and dirty implementation and has a lot of room for code modularization.
In a workbook, import modules/bounding_box.bas.
You can also import forms/formCalcBoundingBox.frm and forms/formCalcBoundingBox.frx for setting params and running
findBoundingBox via a UI.
To launch the UI form, run the macro
Alt + L + PM to launch macro catalogue) and select the desired x, y, and id ranges using the form's controls.
Finally, click "Find!"
A new worksheet will be added that specifies the set of points that will create the bounding shape.
Please feel free push any code that implements the following - patches will be happily accepted
- Better code modularization
- Better documentation
- Change name to "bounding shape" ... technically not a box :)
Any others come to mind? Email me at firstname.lastname@example.org.
Copyright (c) 2012 ElegantBuild, LLC, http://elegantbuild.com/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.