View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default finding UsedRange with sparse data


Have the user select the database and then feed the selection
address back to the user in a MsgBox for confirmation.
Then you verify it by checking that the top left and top right cells
contain "Name" and State" and that there at least two(?) rows in it.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"dbKemp"

wrote in message
I am creating an addin that works with user created 'databases'.
Assume there is a 'database' that looks something like:

Name | Phone | Address | City | State
Dave | | | |
Thom | | | |
Mary | | | |
Joe | | | |
Beth | | | |
Sue |12345 | Home |Town |NY

It can be anywhere on a given worksheet, the only requirement is that
is have no blanks in the first row.
The 'database' is user created so the code doesn't know how many
columns or rows, or where the upper left corner is.
When the user clicks on a cell within the bounds of the 'database' and
then clicks on a menu button provided by the addin, some action is
taken on the database.
When the database is not sparse using activecell.currentregion works
fine. When the 'database' is sparse activecell.currentregion doesn't
work. e.g. user clicked on Mary's Address above.
Any suggestions on how to define the database (CurrentRegion) with
sparse data?