PPRuNe Forums - View Single Post - Any VBA aces here?
View Single Post
Old 4th November 2009 | 20:05
  #5 (permalink)  
Simonta
 
Joined: Jan 2006
Posts: 130
Likes: 0
From: UK
Hi Sprogget.

Take a look at worksheet.usedrange which should return all the rows used in the sheet. It can be a little temperemental if new rows have been added so if it's a possibility, you could add workbook.save to the beginning of the routine. In the majority of workbooks, especially those with perfectly rectangular ranges, as yours appears to have, usedrange is reliable after save.

Alternatively, here's a function which will calculate the used range, thereby providing accuracy.

VBA Express : Excel - True Used Range in Excel

Hope this helps.

Cheers

Simon
Simonta is offline  
Reply