View Single Post
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi Ant

You can use this function fir finding the last row with data on thye worksheet

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

Use this in your code then

Dim Lr As Long
Lr = LastRow(Sheets("Sheet2")) + 1


If you can check one column then use this
Lr = Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row



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


"Ant" wrote in message ...
Each month I add new data to an existing sheet. I then want to run a macro to
insert a new column and a formula. Trouble is this data increases rows each
month and I need to be able to identify the final row each time so I can copy
the formula down. ie in Jan the data finished at row 100. In Feb it finishes
at row 200. I need the macro to be able to know to copy the formula down to
row 200 in Feb for example.