PC Review


Reply
Thread Tools Rate Thread

Cannot hide columns/rows

 
 
PO
Guest
Posts: n/a
 
      19th Jan 2008
Excel 2003, sp2

Hi,

I'm trying to hide columns X:IV so that the user only can see columns A:W.
However Selection.EntireColumn.Hidden = True raises an error - "The hidden
property cannot be set for the range class" (roughly translated from
swedish). As far as I can see there aren't any objects in those columns. I
also tried selection.clear but it still doesn't work. The area is totaly
empty. If I try to hide the columns manualy from within excel I get the
error message "Object cannot be moved outside sheet".

Any ideas?

Regards
Pete


 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      19th Jan 2008
Try this...

Columns("X:IV").EntireColumn.Hidden = True

Rick


"PO" <h> wrote in message news:%(E-Mail Removed)...
> Excel 2003, sp2
>
> Hi,
>
> I'm trying to hide columns X:IV so that the user only can see columns A:W.
> However Selection.EntireColumn.Hidden = True raises an error - "The hidden
> property cannot be set for the range class" (roughly translated from
> swedish). As far as I can see there aren't any objects in those columns. I
> also tried selection.clear but it still doesn't work. The area is totaly
> empty. If I try to hide the columns manualy from within excel I get the
> error message "Object cannot be moved outside sheet".
>
> Any ideas?
>
> Regards
> Pete
>


 
Reply With Quote
 
PO
Guest
Posts: n/a
 
      20th Jan 2008
That doesn't work either. If I try the same code on a new worksheet it
works. It's just this sheet which contains some formulas and formatting -
nothing special. As I said, the cells are empty, they don't contain any
named ranges and they aren't part of any print area. It's some kind of a
mystery really

Regards
Pete


"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> skrev i
meddelandet news:%23LI%(E-Mail Removed)...
> Try this...
>
> Columns("X:IV").EntireColumn.Hidden = True
>
> Rick
>
>
> "PO" <h> wrote in message news:%(E-Mail Removed)...
>> Excel 2003, sp2
>>
>> Hi,
>>
>> I'm trying to hide columns X:IV so that the user only can see columns
>> A:W. However Selection.EntireColumn.Hidden = True raises an error - "The
>> hidden property cannot be set for the range class" (roughly translated
>> from swedish). As far as I can see there aren't any objects in those
>> columns. I also tried selection.clear but it still doesn't work. The area
>> is totaly empty. If I try to hide the columns manualy from within excel I
>> get the error message "Object cannot be moved outside sheet".
>>
>> Any ideas?
>>
>> Regards
>> Pete
>>

>



 
Reply With Quote
 
New Member
Join Date: Jan 2008
Posts: 2
 
      20th Jan 2008
Pete

I suspect that you have comments in columns adjacent to some of the columns that are being hidden. I don't know why that would be a problem, but, it can be. Delete the comments and try again.
Good luck.

Ken
Norfolk, Va
 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      20th Jan 2008
You have your sheet protected, don't you? Try these 3 lines instead...

ActiveSheet.Unprotect
Columns("X:IV").EntireColumn.Hidden = True
ActiveSheet.Protect

or, if not running from worksheet's code window, change the ActiveSheet
reference to the worksheet's name reference...

Worksheets("Sheet1").Unprotect
Worksheets("Sheet1").Columns("X:IV").EntireColumn.Hidden = True
Worksheets("Sheet1").Protect


Rick



"PO" <h> wrote in message news:(E-Mail Removed)...
> That doesn't work either. If I try the same code on a new worksheet it
> works. It's just this sheet which contains some formulas and formatting -
> nothing special. As I said, the cells are empty, they don't contain any
> named ranges and they aren't part of any print area. It's some kind of a
> mystery really
>
> Regards
> Pete
>
>
> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> skrev i
> meddelandet news:%23LI%(E-Mail Removed)...
>> Try this...
>>
>> Columns("X:IV").EntireColumn.Hidden = True
>>
>> Rick
>>
>>
>> "PO" <h> wrote in message news:%(E-Mail Removed)...
>>> Excel 2003, sp2
>>>
>>> Hi,
>>>
>>> I'm trying to hide columns X:IV so that the user only can see columns
>>> A:W. However Selection.EntireColumn.Hidden = True raises an error - "The
>>> hidden property cannot be set for the range class" (roughly translated
>>> from swedish). As far as I can see there aren't any objects in those
>>> columns. I also tried selection.clear but it still doesn't work. The
>>> area is totaly empty. If I try to hide the columns manualy from within
>>> excel I get the error message "Object cannot be moved outside sheet".
>>>
>>> Any ideas?
>>>
>>> Regards
>>> Pete
>>>

>>

>
>


 
Reply With Quote
 
PO
Guest
Posts: n/a
 
      20th Jan 2008
Hi

Neither the sheet nor the book are protected. The funny thing is, if I
broaden col W (columnwidth = 39) I can hide the rest of the columns.

Pete



"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> skrev i
meddelandet news:(E-Mail Removed)...
> You have your sheet protected, don't you? Try these 3 lines instead...
>
> ActiveSheet.Unprotect
> Columns("X:IV").EntireColumn.Hidden = True
> ActiveSheet.Protect
>
> or, if not running from worksheet's code window, change the ActiveSheet
> reference to the worksheet's name reference...
>
> Worksheets("Sheet1").Unprotect
> Worksheets("Sheet1").Columns("X:IV").EntireColumn.Hidden = True
> Worksheets("Sheet1").Protect
>
>
> Rick
>
>
>
> "PO" <h> wrote in message news:(E-Mail Removed)...
>> That doesn't work either. If I try the same code on a new worksheet it
>> works. It's just this sheet which contains some formulas and formatting -
>> nothing special. As I said, the cells are empty, they don't contain any
>> named ranges and they aren't part of any print area. It's some kind of a
>> mystery really
>>
>> Regards
>> Pete
>>
>>
>> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> skrev i
>> meddelandet news:%23LI%(E-Mail Removed)...
>>> Try this...
>>>
>>> Columns("X:IV").EntireColumn.Hidden = True
>>>
>>> Rick
>>>
>>>
>>> "PO" <h> wrote in message
>>> news:%(E-Mail Removed)...
>>>> Excel 2003, sp2
>>>>
>>>> Hi,
>>>>
>>>> I'm trying to hide columns X:IV so that the user only can see columns
>>>> A:W. However Selection.EntireColumn.Hidden = True raises an error -
>>>> "The hidden property cannot be set for the range class" (roughly
>>>> translated from swedish). As far as I can see there aren't any objects
>>>> in those columns. I also tried selection.clear but it still doesn't
>>>> work. The area is totaly empty. If I try to hide the columns manualy
>>>> from within excel I get the error message "Object cannot be moved
>>>> outside sheet".
>>>>
>>>> Any ideas?
>>>>
>>>> Regards
>>>> Pete
>>>>
>>>

>>
>>

>



 
Reply With Quote
 
PO
Guest
Posts: n/a
 
      20th Jan 2008
Solved it. It turnes out that one of the comments is to broad. It's reaching
into col X when visible.

Regards
Pete


"PO" <h> skrev i meddelandet news:%(E-Mail Removed)...
> Excel 2003, sp2
>
> Hi,
>
> I'm trying to hide columns X:IV so that the user only can see columns A:W.
> However Selection.EntireColumn.Hidden = True raises an error - "The hidden
> property cannot be set for the range class" (roughly translated from
> swedish). As far as I can see there aren't any objects in those columns. I
> also tried selection.clear but it still doesn't work. The area is totaly
> empty. If I try to hide the columns manualy from within excel I get the
> error message "Object cannot be moved outside sheet".
>
> Any ideas?
>
> Regards
> Pete
>



 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      20th Jan 2008
Well, I would not have ever thought of **that** as the problem. Thanks for
posting that you found the problem and what the solution was.

I did some testing on different cells and found some differences in how
Excel reacts to comments. Most of the time, simply having the comment touch
a cell, even partly, was enough to block its column from being hidden;
however, in some other cases, a partially touched column was able to be
hidden and, when that happened, the comment was physically shown on the
other side of the cell it was attached to (with the pointer arrow going
straight across the cell). Now I didn't test too much, but I could not find
anyway to control making this happen (I was able to make it happen only
twice).

Rick


"PO" <h> wrote in message news:(E-Mail Removed)...
> Solved it. It turnes out that one of the comments is to broad. It's
> reaching into col X when visible.
>
> Regards
> Pete
>
>
> "PO" <h> skrev i meddelandet
> news:%(E-Mail Removed)...
>> Excel 2003, sp2
>>
>> Hi,
>>
>> I'm trying to hide columns X:IV so that the user only can see columns
>> A:W. However Selection.EntireColumn.Hidden = True raises an error - "The
>> hidden property cannot be set for the range class" (roughly translated
>> from swedish). As far as I can see there aren't any objects in those
>> columns. I also tried selection.clear but it still doesn't work. The area
>> is totaly empty. If I try to hide the columns manualy from within excel I
>> get the error message "Object cannot be moved outside sheet".
>>
>> Any ideas?
>>
>> Regards
>> Pete
>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide columns but not the top rows Oceangate Microsoft Excel Misc 8 25th Nov 2008 05:46 PM
Hide Rows & Columns by date CevaClerkII Microsoft Excel Misc 3 20th Nov 2008 04:33 AM
Hide columns and rows =?Utf-8?B?ZGVsZXRlIGF1dG9tYXRpY2FsbHk=?= Microsoft Excel Worksheet Functions 2 25th Sep 2007 12:49 AM
Hide/Unhide Rows or Columns 2007-User Microsoft Excel Programming 3 22nd Nov 2006 07:44 PM
Hide Rows and Columns Stuart Steven Microsoft Excel Programming 5 17th Jul 2004 04:46 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:49 AM.