MrExcel Publishing
Your One Stop for Excel Tips & Solutions

totals row

Posted by JOE on October 04, 2000 10:09 AM

I would like to add some formulas in the row after the last row of data in my sheet. I would like to do this at the end of my macro. The number of rows changes so I need some sort of loop to find where the first empty row is. The number of columns remains constant. The formulas are totals and what not for the entire sheet.
Any help is appreciated

Posted by Celia on October 06, 2000 6:58 PM


Sub FindLastRow()
Dim LastRow As Integer
With ActiveSheet
LastRow = Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
End With
MsgBox "The last row in the used range is " _
& LastRow
End Sub


Posted by JOE on October 11, 2000 1:55 PM

I am getting this error with this code:
Runtime error 1004
unable to get the find property of the range class
any ideas?

Posted by Celia on October 11, 2000 4:07 PM

I've just run the code and it works.
Will send you a workbook containing the macro.