View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How to obtain the shortest range that encloses all the non empty cells?

Faustino,

The UsedRange property will return the range of cells, from
top-left to bottom-right, that are used. E.g.,

MsgBox ActiveSheet.UsedRange.Address


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"faustino Dina" wrote in message
...
Hi,

How to obtain the range in which cells are defined? I mean, the

Sheet has a
huge number of rows and columns but you use a few of them.

Suppose you fill
the cells D20 and H40, and all others are untouched. I need to

obtain the
range (D20:H40) How can I do that without scanning all the

universe of
cells...?

Thanks in advance
Faustino