G
Guest
Guest
Can someone help me with the following code. This was posted by someone on this board to help me find the "last row (whatever it would be on a given day" for a cut and paste macro. Only trouble is, I get error messages on 3 different lines of it.
Any suggestions???
Sub FindLastRow()
If WorksheetFunction.CountA(Cells)>0 Then
'Search for any entry, by searching backwards by Rows.
lastrow=Cells.Find(What:="*",After:=[A1],_
SearchOrder:=xlByRows
SearchDirection:=xlPrevious).Row
End If
EndofList=lastrow
Range("A1").Select
ActiveCell.Offset(EndofList,1).Range("A1").Select
End Sub
It definitely doesn't like the underscores, nor the "Search for any entry" line. Can anyone help with this?
Thanks very much!
Any suggestions???
Sub FindLastRow()
If WorksheetFunction.CountA(Cells)>0 Then
'Search for any entry, by searching backwards by Rows.
lastrow=Cells.Find(What:="*",After:=[A1],_
SearchOrder:=xlByRows
SearchDirection:=xlPrevious).Row
End If
EndofList=lastrow
Range("A1").Select
ActiveCell.Offset(EndofList,1).Range("A1").Select
End Sub
It definitely doesn't like the underscores, nor the "Search for any entry" line. Can anyone help with this?
Thanks very much!