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 April 7, 2017)

9

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

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

Sending an E-mail when a Due Date is Reached

Wouldn't it be great if Excel could automatically e-mail you when a due date is reached? It can, if you are using Outlook and ...

Discover More

Calculating Only the Active Workbook

When you enter information into a workbook, Excel automatically recalculates every worksheet in every open workbook on your ...

Discover More

Creating Folders

Folders are an organizational tool that allow you to easily store like items in Drive. This tip examines how easy it is to ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Creating a Copy without Formulas

Excel makes copying worksheets (duplicating them) rather easy. However, you may want a worksheet copy that differs from the ...

Discover More

Jumping to a Specific Worksheet

Want to make fast work of moving from one worksheet to another? Here's how to do the task when you have a lot of worksheets ...

Discover More

Creating Worksheets from a List of Names

Need to create a large number of worksheets using specific names? If so, you'll love the ideas presented in this tip.

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 8Mpixels. 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 7 - 0?

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.