View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Used range row count throwing up a wierd result, slects wrong as well!

Usedrange has a known bug in that it holds on to previous values. See
http://www.contextures.com/xlfaqApp.html#Unused

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mark Stephens" wrote in message
...
Hi, this is a strange one...the following items reside in column 1 from
rwos 1 to 10:

Local cash
Local bond
Local equity
Local property
Foreign currency
Foreign bonds
Foreign Equity
Foreigh property
Alternative
Commodity


My code wants the number of items (i.e. the number of non empty rows:

bNoItems = Sheets(sSheetName & "_Items").UsedRange.Rows.Count

Answer comes back 13 not 10! Also when I try and select it it selects 3
empty cells on the end (aty least it's consistent!). Anyone any idea what
may be wrong/with a better way of achieving the count, thanks, Mark