This is a sample Excel AddIn to reset the last worsheet cell in an Excel Workbook.
Microsoft Excel saves only the part of each worksheet that is in use, meaning the section that contains data or formatting. Sometimes the last cell of a worksheet may be beyond the range of your actual used data. This issue may cause you to have a larger file
size than neccesary, you may print extra pages, you may receive "Out of Memory" error messages, or you may experience other unusual behavior. Clearing the excess rows and columns to reset the last cell can help to resolve these issues.
Note You can locate the last cell of the active worksheet by pressing CTRL+SHIFT+END.
This is a sample of the code located in Microsoft KB 244435
How to reset the last cell in Excel