+ Reply to Thread
Results 1 to 19 of 19

can't hide columns

  1. #1
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    can't hide columns

    I just started getting an error message that I can't hide columns.

    In the Worksheet_Activate() event I have some entire columns being hidden (I:IT). It has worked fine for over a year, and it works fine on other sheets in the same file.
    It gives Err number 1004, which is no help. It just says that columns weren't hidden, but doesn't give me any reason for why they weren't hidden.

    Are there any typical reasons why the columns can't be hidden?
    Last edited by foxguy; 04-01-2011 at 04:39 PM.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    Is the worksheet protected?
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    The worksheet is protected with UserInterFaceOnly:=True.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    I just closed and reopened the worksheet, and now it hides the columns. I should have thought of that first.

  5. #5
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    Does the UserInterfaceOnly protection get kicked in when the workbook is opened? I guess it got lost somehow...

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    I spoke too soon. I reopened an earlier version of the file. When I opened the correct file, the problem was still there.

  7. #7
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    If you run this test:
    • Manually unprotect the sheet
    • Manually try to hide those columns
    Do you get an error about shifting objects?

  8. #8
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    I can't imagine how the UserInterfaceOnly could have gotten lost. My Workbook_Open() event puts it onto every sheet, and I never manually protect a sheet (I'm not even sure I remember how). I always use a macro attached to a menu button to protect sheets.

  9. #9
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    As it turns out. I did try earlier to insert columns and got the about to shift objects error. I did not insert the columns. Instead I just inserted in the rows that I was working in, and had no problem.

  10. #10
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    As it turns out. I did try earlier to insert columns and got the about to shift objects error
    Okay, that explains the RTE then. Perhaps there are some cell comments which are causing the problem?

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

  11. #11
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    Now this is weird.
    There are no comments on the sheet.

    I tried manually hiding the the columns and got the error can't shift object off the sheet.
    I have a macro attached to a menu button that toggle the hidden property of the sheet and it worked fine (it didn't work before which is what triggered this thread). And now I can manually hide the columns with no error.

  12. #12
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    What is RTE?

  13. #13
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    RTE = Runtime Error

    Are there any other objects (hidden or visible) floating on the sheet?

  14. #14
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    Spoke too soon again. I still had the earlier version open and was working on it.

    The real file will not hide the columns manually or by macro.

    There are Active-X buttons on the sheet, but they are all to the left of the columns I'm trying to hide.

  15. #15
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    I found an updated MS article:
    http://support.microsoft.com/kb/211769

    See if anything rings true?

  16. #16
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    The article didn't help, but it did give me an idea.

    I think I found the problem.

    I have a comment in column "I" (that I forgot about), and the comment is about 4 columns wide. When I try to hide columns that would force the display of the comment to extend beyond the visible columns I get the error. As long as the comment can display within the visible area of the sheet, then no problem.

    And it doesn't matter whether the comment is visible or not.

  17. #17
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    I found a solution.

    I widened column IV wide enough to accomodate the entire comment in column I, and now I can hide all the columns between I and IV.

    Thanks for the assist.

  18. #18
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: can't hide columns

    Yes, that comment is the problem (I did ask about comments earlier!). Glad you got it sorted.

  19. #19
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: can't hide columns

    I had forgotten that there was 1 comment on the sheet. But since it was to the left of the columns I was trying to hide, I would have bet that it didn't make any difference.

    Well you learn something new every day.

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1