View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Reference the last 13 rows of data

Copy both in a formula and run test

Copy both in a module and run test


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Hi Robert

Try this example for the activesheet

Copy both in a formula and run test
There is no error checking if there are less then 13 rows

Sub test()
range(Cells(LastRow(ActiveSheet) - 12, 1), Cells(LastRow(ActiveSheet), 1)).EntireRow.Select
End Sub

Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
after:=sh.range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Robert Gillard" wrote in message .uk...

At the moment each month a new row of data is added to the bottom of a "RawData" sheet, this sheet holds monthly data from 2003.
A Summary sheet details just the last 13 months of data. At the moment, each month I have to delete the top month and copy and
paste the "new" months data on the bottom.
I believe I can set a formula that will always select the last 13 rows of data from the "RawData" sheet, I regret I do not know
how to go about this, can anybody help please.

With thanks

Bob