Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Irma Brown   on Nov 04 In MS Office Category.

  
Question Answered By: Stefan Thompson   on Nov 04

Are the values in the date field all filled? with no blank rows?
If they are, then you can use a worksheet function to get a count
of the number of rows:

Rowcnt = Application.WorksheetFunction.CountA(Range("A1:A65000"))

then, your last (5) rows are:
Range(Cells(Rowcnt-4,1),Cells(Rowcnt,1))
or
Range(Rowcnt -4 & ":" & Rowcnt)

depending on how you want to use the row numbers.

If the data has some blank cells, then either you have to use a column
that ALWAYS has data to count the rows, or you have to get more creative
(like the previously mentioned Range("A65000").Select and XLup)

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Variable Ranges, Loop? Or get search suggestion and latest updates.


Tagged: