Reset Cursor in Calc

I need to reset the cursor in a Calc macro.
A file used to record data for 2002 was copied then renamed. 2022 data was deleted from one of the sheets.
Now the Macro that creates entry rows for the current day does not work.
The problem is in the cursor, setup with the following code:

Cell = ASheet.getCellRangeByName("A1")
Cur = ASheet.createCursorByRange(Cell)
Cur.gotoEndOfUsedArea(True)

This years spredsheet has 21 rows today.
This is theCursor rnage:

	MsgBox "Current range (1) is " & Rng.AbsoluteName & Chr(13)&_
			"Column = " & Rng.RangeAddress.StartColumn & Chr(13)&_
			"Row = " & Rng.RangeAddress.EndRow & Chr(13)

Current range (1) is $Meals.$A$1:$J$2047
Column = 0
Row = 2046

How do I reset the Cursor?
I tried creating a new cursor. That report the same values.
Thank You

Try select rows 22 to 2047 and delete them. Save and reopen the document.

That worked.
Deleted the whole rows. There was some leftover formulas That I missed the first time.
Thank You
Marlin