Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Shifting Objects Off a Sheet.

Shifting Objects Off a Sheet

by Allen Wyatt
(last updated June 23, 2018)

10

Mudit ran into problems when trying to delete rows and columns in a worksheet. He sometimes gets the message "Cannot shift object off this sheet." Other people report getting the message when they try to insert rows or column.

What is happening is that an object—such as a graph, drawing object, text box, picture, or even comment—cannot be correctly handled by Excel after the deletion or insertion. If the error occurs when inserting rows or columns, it means that the insertion would push the object beyond the right or bottom boundaries of the worksheet. The solution, of course, is to check whatever is at the right or bottom of the worksheet and make changes to those objects (move or delete them) as necessary.

If the error occurs while deleting rows or columns, it is normally because there are objects attached to cells within those rows or columns, and deleting the rows or columns would leave the objects "orphaned" in some way. For instance, let's say you are deleting column D, and there is an object associated with cell D4. The object doesn't need to be situated over column D; it could be several columns away, but still belong to cell D4. If you delete column D, then the object no longer has an anchor point. Excel's solution? Don't let column D be deleted until you do something with the object that would be orphaned by the edit.

The problem can also occur if the objects in a worksheet are formatted so that they cannot be moved or sized automatically by Excel, and then you try to delete columns or rows associated with the objects. In this case, you may want to try changing the formatting of the objects in the worksheet. If you have a lot of such objects in the worksheet, the following macro can be helpful in making the change:

Sub ResetShapes()
    Dim s As Shape
    On Error Resume Next
    For Each s In ActiveSheet.Shapes
        s.Placement = xlMoveAndSize
    Next
End Sub

Microsoft provides a Knowledge Base article that can be helpful with this problem. The article specifically addresses the issue of hiding rows and columns, but the solutions work when you are trying to delete them, as well. You can check it out at this page:

http://support.microsoft.com/kb/211769

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (809) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Shifting Objects Off a Sheet.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Upside-Down Printing

Putting words on the printed page is easy in Word. Rotating those words in different manners can be a bit trickier. This ...

Discover More

Copying Formats

Want to copy a format from one place to another without taking your hands off the keyboard? It's easy to do if you apply ...

Discover More

Using Named Ranges in a Macro

Named ranges are a great capability provided by Excel. You can define all sorts of named ranges in a workbook, but how do ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Dynamic Worksheet Tab Names

Need a worksheet's name to change based on the contents of a cell? You'll need to rely on a macro to do the changing, but ...

Discover More

Quickly Inserting a New Worksheet

Want a quick way to insert a worksheet? There's nothing faster than using the handy shortcut.

Discover More

Identifying the Last Cell Changed in a Worksheet

When someone changes a cell in a worksheet, Excel normally goes along its merry way of keeping everything up to date. It ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 8?

2018-01-19 06:20:13

Mich

On my side, got this when refreshing pivot table. Was due to an inserted comment. Solved as soon deleted/removed.


2017-04-07 08:04:33

RKeev

Happens to me due to Comments.
I use this to ensure comments are placed correctly:

Sub MoveComments()
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
With cmt
.Shape.Top = .Parent.Top
.Shape.Left = .Parent.Offset(0, 1).Left
End With
Next
End Sub


2016-07-18 12:35:13

Joshua

Found so many other sites that offered the same useless solution.

This post was great, and it worked!

Wish I saw this one first.


2016-07-03 18:37:05

Robert Armstrong

All the other posts I found on the internet we totally useless, but this worked straight off, so thank you very much for this.


2015-06-09 20:49:25

Lauren Raymundo

I had the same problem and NOTHING helped me. I could type or copy/paste into the blank columns on the right of my spreadsheet, but could not insert a column. I removed the data filtering and VOILA, it worked.


2015-02-11 08:57:35

ruban

It is not working in my sheet, Please guide me.


2014-09-19 11:42:20

Jan

I'm using 2010 version and I just started getting this when trying to insert row. My spreadsheet has 808 lines of data. I cannot insert even 1 line - HELP!!


2014-07-15 11:21:19

dbjbdbj

COMMENTS
I had the same problem trying to delete all rows below the useful data. Turns out that the COMMENTS I had on some cells in the top row had somehow been made VERY TALL. In fact, when I would enter "Edit Comment" and check the "Format Comment" window, I found that the "Height" was BLANK. When I made the comments short enough such that they fit within the useful data (and not overlap into the rows I was trying to delete), the ERROR STOPPED!


2013-10-08 06:36:09

Youssef Amarir

Hello,

I'm really grateful for this useful tip. It worked immediately!

Youssef


2013-01-16 13:43:35

gerdami

That's amazing. I got this error message today...

However, I won't use .xlMoveAndSize because I hate this resizing feature. I will simply use .xlMove (Move but don't size with cells )


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.