Excel VB Q
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

[Closed] Excel VB Q

5 Posts
4 Users
0 Reactions
60 Views
Posts: 13594
Free Member
Topic starter
 

Is there a way of finding the size of the WS in use?

All I can find is

WorkSheet.Rows.Count which seems to always be 65536
CurrentRegion.Rows.Count which is just the local region bounded by one blank row/col

TIA...


 
Posted : 03/12/2009 4:04 pm
Posts: 0
Free Member
 

what do you mean size of the WS, physical kb size or rows x column size ?

65536 is the maximum amount of rows you can have in Excel anyway.


 
Posted : 03/12/2009 4:06 pm
Posts: 13594
Free Member
Topic starter
 

I meant the populated size - it knows you're not using the whole WS from the way the windows scrolls. So if I'm writing a macro to process populated rows, I don't want to to 1 to 65536 - way too slow. I want to do 1 to last_row - only I can't figure out how to work out what the last used row is.


 
Posted : 03/12/2009 4:09 pm
Posts: 0
Free Member
 

65536 limit has been abolished in Excel 2007/10


 
Posted : 03/12/2009 4:09 pm
Posts: 0
Free Member
 

Have you tried the UsedRange property?

worksheet.usedrange.rows.count
worksheet.usedrange.columns.count

Not sure if it's still current in the latest version of excel (i'm using 2002).


 
Posted : 03/12/2009 4:12 pm
Posts: 13594
Free Member
Topic starter
 

Hey schnullelieber - that worked!

Thanks


 
Posted : 03/12/2009 4:33 pm