View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Find Used area of a range

Dim rnga as Range, rngb as Range
Dim rng as Range
set rnga = Cells(rows.count,1).End(xlup)
set rngb = cells(rows.count,2).end(xlup)
if rnga.row rngb.row then
set rng = Range("A5",rnga).Resize(,2)
else
set rng = Range("A5",rngb)
end if
msgbox rng.Address

--
Regards,
Tom Ogilvy

"MDW" wrote in message
...
I know that Excel allows you to create a range of the utilized area of a

sheet. However, is there an easy way to find the utilized area of a range?
For instance, if my area of interest is A5:B - essentially the first two
columns, starting at the fifth row. There could be 1 entry in that space,
or 50. (For all practical purposes, I doubt we'd ever come close to, say,
500, so the starting out range could be something like A5:B750).

But, given those bounds, is there an easy way for me to create a sub-range

that is just the utilized area of that main range?