Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/100406

From BetaArchive Wiki

PSS ID Number: 100406

Article Last Modified on 8/15/2003

The information in this article applies to:

  • Microsoft Excel for Windows 95 7.0
  • Microsoft Excel for Windows NT 5.0
  • Microsoft Excel for Windows 5.0c
  • Microsoft Excel for Windows 5.0
  • Microsoft Excel for Windows 4.0c
  • Microsoft Excel for Windows 4.0a
  • Microsoft Excel for Windows 4.0
  • Microsoft Excel for Windows 3.0a
  • Microsoft Excel for Windows 3.0
  • Microsoft Excel for Windows 2.10d
  • Microsoft Excel for Windows 2.10c
  • Microsoft Excel for Windows 2.1
  • Microsoft Excel for Windows 2.01
  • Microsoft Excel for Windows 2.0

This article was previously published under Q100406


In Microsoft Excel, you can press CTRL+END to select the last cell in a cell table or dependency table. In some cases this cell may be well beyond the actual data in your worksheet. In some cases, this cell may result in memory or printing problems.

To reset the last cell address, you must clear all information (data and formatting) from the unused columns and rows of your sheet.


If you are working with a large sheet that contains many formulas or a lot of formatting, you may experience similar memory problems when you attempt to copy and paste information.


To work around this problem, do any of the following:

Reset the last cell by deleting excess rows and columns

  1. Select all rows and or columns that do not include any data by selecting the appropriate row and/or column headings.
  2. From the Edit menu, choose Clear and select the All option.
  3. From the Edit menu, choose Delete.
  4. Repeat steps 1-3 for as many columns or rows as is necessary.
  5. From the File menu, choose Save As and save the file with another name.
  6. Close the file and reopen it.

Use the following macro to clear blank cells

WARNING: ANY USE OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  1. In a macro sheet, enter the following:

          A1: ClearCells
          A2: =ERROR(FALSE)
          A3: =ECHO(FALSE)
          A4: =SELECT.LAST.CELL()
          A5: =ROW(ACTIVE.CELL())
          A6: =IF(ISBLANK(ACTIVE.CELL()),CLEAR(1))
          A8: =GOTO(A6)
  2. Select cell A1 and choose Define Name from the Formula menu. Select the Command button and choose OK.
  3. Activate the worksheet. Choose Run from the Macro menu and run the ClearCells macro.

After the macro has finished running, save the worksheet, close it, and then reopen it. Your last cell (the cell you get when you press CTRL+END) should be the last cell that contains data.

CAUTION: This macro will delete ALL cell contents (formats, notes, and defined names) that do not have a physical entry within the cell.

NOTE: The ERROR(FALSE) and ECHO(FALSE) functions in cells A2:A3 are not required for this macro to run correctly; however, these functions do significantly increase performance.

To create an example to try the above procedures, do the following:

  1. Open a new Sheet.
  2. Create cell entries from A1 to F15.
  3. In cell H25, type a number and then clear the value from that cell.
  4. From the Formula menu, choose Select Special. When you select the Last Cell option and choose OK button, cell H25 is selected.

If you select row number 25 and choose Delete from the Edit menu, and select column H and choose Delete from the Edit menu. The cell address remains H25 until you select a cell in the A1 to F15 range and save the file.

NOTE: If you are using Microsoft Excel version 3.0 or earlier, H25 will remain the last cell address until you close the file and reopen it. In versions 4.0a and 5.0, you can Clear All and then Save; it is not necessary to reopen the file.


"Function Reference," version 4.0, pages 57, 122, 135, 364
"Function Reference," version 3.0, pages 33, 62, 68, 201

Additional query words: 3.00 4.00 4.00a erase pointer HOWTO Excel

Keywords: kberrmsg KB100406
Technology: kbExcel200 kbExcel201 kbExcel210 kbExcel210c kbExcel210d kbExcel300 kbExcel300a kbExcel400 kbExcel400a kbExcel400c kbExcel500 kbExcel500c kbExcel500NT kbExcel95 kbExcel95Search kbExcelSearch kbExcelWinSearch