+ Reply to Thread
Results 1 to 12 of 12

Unable to Hide a column in Excel 97-2003 workbook

  1. #1
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Unable to Hide a column in Excel 97-2003 workbook

    I am trying to hide a column A1 in my sheet using vba. But am getting a error "unable to set hidden property of range class"

    Here is my code:





    Please Login or Register  to view this content.
    Am getting error in the line



    Selection.EntireColumn.Hidden = True


    I have included MsgBox to check whether the sheet is protected and is there any comment available in the cells of that column.

    1st MsgBox returns as No Comments and 2nd returns as false.

    So the sheet is not protected and comment is also not present.

    Confused on why getting the error eventhough.

    Please help me out

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    I think the other thing that would cause that (apart from comments/protection) is if you have objects/drawn shapes which don't resize.

  3. #3
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Unable to Hide a column in Excel 97-2003 workbook

    How could i check that?

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    Please Login or Register  to view this content.
    I guess

  5. #5
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Unable to Hide a column in Excel 97-2003 workbook

    Yes... It is the shapes.. Done as you mentioned and it is hidden. But I have added comments to other column headers which i get on hovering mouse over the cell. Am not getting the comments now..

    Does deleting shapes have something to do with comments?

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    I think the comments are contained in the activesheet.shapes collection so yes, they will be deleted also. You just need to set the objects that are in the column you want to hide so that they resize with cells/text I think.

  7. #7
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Unable to Hide a column in Excel 97-2003 workbook

    So i have 6 column.. I don't have any comment in the column which i hide. So I need to hide the column and should not delete the comments in other 5 columns as well? Is there any way to achieve that?

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    You could try:
    Please Login or Register  to view this content.
    but I'm not certain that would work.

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    Or set the objects in the column you want to hide so that they resize with text/cells as I mentioned in post 7.

  10. #10
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Unable to Hide a column in Excel 97-2003 workbook

    No that didn work.. I couldn't understand how to set object.Can u share me a code snippet on how to set the objects in a column.

  11. #11
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Unable to Hide a column in Excel 97-2003 workbook

    sh.placement = xlMoveAndSize

  12. #12
    Registered User
    Join Date
    11-07-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Unable to Hide a column in Excel 97-2003 workbook

    Thanks a lot.. Works Perfect

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Unable to Delete Trendline in Excel 2003
    By lengli02 in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 12-10-2010, 02:42 AM
  2. Unable to edit Excel 2003 file
    By JohnIT in forum Excel General
    Replies: 3
    Last Post: 07-21-2006, 08:40 AM
  3. [SOLVED] Unable To OPen Excel 2003
    By John Sullivant in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-27-2006, 11:45 AM
  4. unable to instal KB905756 Excel 2003
    By Out of Office Assistant command in forum Excel General
    Replies: 0
    Last Post: 04-06-2006, 04:35 AM
  5. Unable to open Template in Excel 2003
    By NYBrianK in forum Excel General
    Replies: 0
    Last Post: 01-05-2005, 06:06 PM

Tags for this Thread

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