Solved

"Cannot Shift Objects off Sheet"

Posted on 2010-11-18
8
724 Views
Last Modified: 2012-06-22
I have a spreadsheet that I want to keep the focus on just what has been entered.  The easiest way, it seems, is to just check to see if the last row + 1 is hidden. If yes, then unhide row and add data.  There is one object on the sheet, an image.  When I try to all of the rows/columns, from the last filled row (23), an error appears:

"Cannot Shift Objects off Sheet"

Even after removing the image, the error still appears.  What's odd is that all of the rows except 1048573:1048576 can be hidden and all of the columns except the one just adjacent to the "Table" can be hidden.  I had the Table as a Table, but also converted it back to a normal range with no effect.

I was able to "Fill" those four rows with a color that is similar to the hidden background, but it looks odd when the last row of the table is 23 and the next row is 1048573.  Yes, I can keep the rows and column headers from showing, but am curious at why this error is occurring, and what can be done  to fix it, instead of just apply a workaround patch .

There have been several suggestions that I found on the net, as far as changing certain settings and/or clearing contents but those haven't helped either.

The other quick question is that it seems that hiding all of the unused rows consumes a lot of memory resources (makes it very slow), would this be correct or could there be something else involved?

Are there any other suggestions?
0
Comment
Question by:Cook09
  • 4
  • 2
  • 2
8 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 34165038
Hiding rows should not make things slow. It sounds to me as though you have shapes you don't know about on your sheet. What does:
Msgbox Activesheet.shapes.count

produce? It can also be an issue if you have comments in cells that would end up being positioned off the sheet.
0
 
LVL 2

Expert Comment

by:gdonaher
ID: 34165051
Good-day,

A thought:

Sometimes when hiding rows/columns an object on the spreadsheet (such as a picture) will be resized to basically zero width/hight.  It can then be sometimes difficult to find it and remove it.  If there is something there it will produce the error you are getting.

If this isn't it try posting your file so we can take a look.

Hope this helps,

-Garrett
0
 

Author Comment

by:Cook09
ID: 34165151
I come up with 7 shapes, and where those would be, I don't know.  If I remove the one I want to keep, will changing .count with .delete remove the other six.

0
 
LVL 2

Assisted Solution

by:gdonaher
gdonaher earned 250 total points
ID: 34165299
Good-day,

".Delete" won't work for you but ".SelectAll" will select them on the worksheet, the you can just press the delete key.

Hope this works for you,

-Garrett
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Cook09
ID: 34165341
I did a check on the objects within the sheet and this is what returned:

Name      Visible(-1) or Not Visible(0)      Shape type
Comment 4                     0                           4
Comment 15                   0                           4
Comment 16                   0                           4
Comment 17                   0                           4


I do have 4 comments, lines 20-23.  Does having a comment on the last line make a difference?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34165442
In the UI if you press f5, then Special... Then choose objects, that will select them so you can delete the shapes.
0
 

Author Comment

by:Cook09
ID: 34165470
After Deleting all of the the Type 12 and 13 shapes, plus the Comments, then the Error cleared and I was able to Hide all the rows from 23 to end.  I don't know whether there was a stray shape or maybe if the last row has a comment in it, it poses an issue.

But, it seems fixed at this time.

Thanks for pointing me in the right direction.
Sub ShapesDelete()

'Ran each individually

    Dim myshape As Shape

    For Each myshape In ActiveSheet.Shapes

         'If myshape.Type = 12 Then myshape.DELETE  'ActiveX Control

        If myshape.Type = 13 Then myshape.DELETE    'Image

 

    Next myshape

End Sub







Sub Comments()

    ActiveSheet.Cells.ClearComments

End Sub

Open in new window

0
 

Author Closing Comment

by:Cook09
ID: 34165523
There may have been several issues, but through working on the different possibilities, the solution was found, be it shapes or comments.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now