Okay, but you can do it a lot simpler notwithstanding the limitations of UsedRange

[vba]

Function GetBottomRow(ByVal sh As Worksheet) As Long

With sh
GetBottomRow = .UsedRange(.UsedRange.Count).Row
End With
End Function
[/vba]