View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default UsedRange and CurrentRegion

As you have discovered, UsedRange is the area of the sheet that has been
'Used' for any purpose, since it was last saved. CurrentRegion is the area
of contiguous cells surrounding the ActiveCell, that have data. You will
need to select whichever is appropriate for your needs at the time.
Mike F
"Tomas M." wrote in message
...
Hi,
I need to know realy last row and column, which contains data. I tried to
use UsedRange properties of object worksheet, but this is not what I want

in
all real cases:

Sheets("Sheet1").usedrange.rows.count

UsedRange.rows.count properties count also rows only with some formatting
and with no data. Then I tried to use:

Sheets("Sheet1").usedrange.CurrentRegion.rows.coun t

and seems to work OK. Do the last code example find realy last row or

column
or count of them in all cases, or is there some better way to get this

always
?

Thanks for answer.
Tomas M.