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
>>>
>>
>
>