You can use this example that use a function
Sub test()
MsgBox LastRow(ActiveSheet)
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
wrote in message ...
I need to set a variable equal to my final row that
contains data. I have a function, but it only checks for
the final row that contains data in column A. My final
row sometimes doesn't contain data in column A, but it
will always be in column A or column B. This is what I
have. Thanks for the help. I need it to give the number
of the last row containing data in column A or column B/
FinalRow = Cells(65536, 1).End(xlUp).Row