PPRuNe Forums - View Single Post - Any VBA aces here?
View Single Post
Old 4th Nov 2009, 20:05
  #5 (permalink)  
Simonta
 
Join Date: Jan 2006
Location: UK
Posts: 130
Likes: 0
Received 0 Likes on 0 Posts
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