Deleting Rows In Excel Doesn't Reset Last Cell (Used Range)

I appreciate the the extra effort you've taken to document your efforts. Thank you.

I frequently reset bloated books using the methods that don't work for you.  There are only two differences I can identify:

The first is that I've never tried to right-click -> delete. I'm a keyboard guy so I've always used Alt+E+D. That shouldn't matter one bit, but stranger things have happened.

The second difference is that I've never been stuck like you, it always resets after saving. Big help there, right?

A few possible solutions follow:

Horizontal/Vertical Bloats

Today I had an issue where my VBA merged sheets vertically and my worksheet inexplicably bloated horizontally. I was initially confused and concerned because I've only had vertical bloat and didn't think to check horizontally, until my reset attempt failed twice. Please humor me for the sake of completeness and to keep that from happening to you:

  1. Begin by closing any other Excel sessions, so the current workbook is the only workbook open.
  2. Go to the of your data on the right side and select the first empty column - the whole column.
  3. Ctrl+Shift+.
  4. Alt+E, then D.
  5. Ctrl+Shift+End.
  6. Alt+E, then D.
  7. Ctrl+Home
  8. Scroll to the bottom of your data
  9. Select the first empty row - the whole row.
  10. Ctrl+Shift+.
  11. Alt+E, then D.
  12. Ctrl+Shift+End.
  13. Alt+E, then D.
  14. Ctrl+Home
  15. Ctrl+S

Yes, the two Ctrl+Shift+End lines are redundant, but I think your can survive the 15 keystrokes.

You "shouldn't" need to close your workbook after saving it, but I won't advise against it.  Give it a shot. If that doesn't work, well - try VBA real quick.

The VBA Way

Don't be afraid of the big bad VBA, it's a great tool and what we're doing well only take a few seconds.

  1. Make sure the suspected worksheet is open and active.
  2. Alt+F11 to open the editor.
  3. Ctrl+G to open the immediate window.
  4. Type ?activesheet.usedrange.address and press Enter.
  5. If the range looks normal (not excessively large) then the problem is not your range.
  6. If the range is excessively large. then type activesheet.usedrange and press Enter. Note the first command used a ? and this doesn't.  That's because the question mark is used when we want VBA to display text, so we can see a value or status. If we don't use a question mark, then we're telling VBA to perform an action.
  7. Once you've pressed Enter, put your cursor on the line where you used the ? and press Enter.
  8. if the range changed then you're done. If it's the same, then you still have a problem.

Very Hidden Worksheets

The final task is to look for hidden worksheets. Not just hidden, but very hidden (I'm not making this up).

  1. The project explorer should already be open on the left side of the screen. Press Ctrl+R if it isn't.
  2. The window has minor differences between Excel versions, but they all share the same expanding/collapsing tree behavior. 
  3. The number of projects displayed depends on the number of open Excel workbooks and addins. If you closed all other workbooks and there are more than a few projects showing, then you've got something else going on that we can cover in detail later.
  4. For now, find your project and expand the folders to expose the workbook objects (the individual worksheets and the ThisWorkbook object). You'll recognize them because they will have your worksheet names in brackets.
  5. Once found, look for a name that isn't listed in your workbook with a worksheet tab.
  6. if you find one, select it in the explorer window and go to the properties window (below the explorer or F4).
  7. Scroll down to find visible, it should be one of two values: xlhidden or xlveryhidden.
  8. Click inside the value to open a drop-down menu, and select xlvisible.
  9. If it is neither of these, then you've selected the wrong sheet and possibly wrong project, - double check your selections. 
  10. If you found and un-hid the sheets, then go back to every one of them and reset those ranges to see if your book shrunk (don't forget to re-hide the sheets.

FYI: A very hidden sheet is not listed in the hide/unhide context menu in Excel, so it's one of the better ways way to protect configurations and helper columns.

  1. We're done with VBA, so close the editor and go back to Excel. Press Ctrl+F3 to open the name manager.
  2. Look for unexpected named ranges. I generally don't recommend deleting named ranges unless you are very familiar with your workbook, because a lot of productive Excel/VBA  solutions will not function properly if you remove a range they need; however, if you find a range with errors, pointing to non-existent workbooks, referencing unused ranges, or with some other blatantly wrong value - then they are ripe for removal.

Some Other Helpful Advice

This is significantly longer than I anticipated so I'll try to wrap it up ...

  • Check your Conditional formatting - just like named ranges, you're looking for blatantly wrong or reproduced conditions.

  • Check your queries and data models.

  • Verify you don't have pictures/charts/listobjects in a hard to find location (the check we did with name manager should catch most, but not all, of them).

  • Verify you don't have custom configuration settings out of whack (I noticed a colleague's style gallery on the home tab was populated with the same 20% accent, and expanding it revealed hundreds. Using the VBA editor, I typed ?activeworkbook.styles.count and it returned more than 19,000; for comparison, mine had 47).

  • Watch for excessive formatting - a few hundred thousand rows of numbers formatted as currency is not the same as a few hundred thousand rows formatted with cell borders patterned like a maze filed with different colors and many different custom number formats, symbols, and fonts.

  • Check the data itself, a few hundred rows spanning 20 columns with every cell filled to the limit would be an embarrassing - but possible - cause of bloat

  • And lastly, the nuclear option. Save each sheet separately as a CSV text file and import it into a new workbook... this thing is guaranteed to work unless you have corrupt data - but rebuilding your formats, connections, and bla bla bla could be a pain.


I just spent a few hours chasing this down. Every one of the manual tricks - selecting, deleting, using the "Clear Formatting" menu command, deleting rows, using VBA to delete rows, telling VBA to recalculate UsedRange all failed. The file would not get smaller and the UsedRange was always the max (million) rows.

The key -- when you print the UsedRange.Address in VBA, there are no row numbers!

? activesheet.usedrange.address
$A:$AH

So there is no subset of the rows specified in UsedRange. Something is forcing the range to the entire sheet. In my case, that something was RowHeight.

This worked for me. Open VBA (Alt-F11) and use the Immediate mode window. Enter these one at a time:

? activesheet.name
[shows sheet name]
? activesheet.usedrange.address
$A:$AH
activesheet.usedrange.rowheight = 23
? activesheet.usedrange.address
$A$11:$AH$1493

Not only does universally changing the rowheight allow the UsedRange to be smaller, it automatically recalculated UsedRange for me as part of the change!

Bingo, the file is now 2.5MB smaller.