Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
Is there a way of hiding columns in named ranges in VBA? I've got a load of
columns that I want to show and hide, but I might want to add other columns in the worksheets later, so named ranges would make life easier. I would have thought it was simple, but I just get an error that I'm "unable to set hidden property of range class" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
Hi
Either of these will hide column 2 in range "tester" ActiveSheet.Range("tester").Columns(2).Hidden = True or ActiveSheet.Range("tester").Cells(1,2).EntireColum n.Hidden = True There is no Hide method, so this won't work ActiveSheet.Range("tester").Columns(2).Hide no matter how tempting it looks! regards Paul On Apr 28, 12:21*pm, malcomio wrote: Is there a way of hiding columns in named ranges in VBA? I've got a load of columns that I want to show and hide, but I might want to add other columns in the worksheets later, so named ranges would make life easier. I would have thought it was simple, but I just get an error that I'm "unable to set hidden property of range class" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
Forgot to mention You may also find this useful With ActiveSheet.Range("tester") .Range(.Columns(2), .Columns(4)).Hidden = True End With which will hide columns 2 to 4. regards Paul On Apr 28, 12:32*pm, wrote: Hi Either of these will hide column 2 in range "tester" ActiveSheet.Range("tester").Columns(2).Hidden = True or ActiveSheet.Range("tester").Cells(1,2).EntireColum n.Hidden = True There is no Hide method, so this won't work ActiveSheet.Range("tester").Columns(2).Hide no matter how tempting it looks! regards Paul On Apr 28, 12:21*pm, malcomio wrote: Is there a way of hiding columns in named ranges in VBA? I've got a load of columns that I want to show and hide, but I might want to add other columns in the worksheets later, so named ranges would make life easier. I would have thought it was simple, but I just get an error that I'm "unable to set hidden property of range class"- Hide quoted text - - Show quoted text - |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
thanks Paul
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
do you know if pivot tables on a worksheet cause problems? maybe i'm having
problems with worksheet and workbook scope, but I have a range of columns K:V called "wholeyear", scoped to each worksheet, and when I run the procedure it hides columns U:AF. Very strange, especially as this isn't a named range at all. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
Hi
Are you hiding columns relative to some range e.g. Range("B1:C1").Columns("B:B").Hidden = true will hide the second column in "B1:C1" i.e. column C of the worksheet. regards Paul On Apr 28, 2:25*pm, malcomio wrote: do you know if pivot tables on a worksheet cause problems? maybe i'm having problems with worksheet and workbook scope, but I have a range of columns K:V called "wholeyear", scoped to each worksheet, and when I run the procedure it hides columns U:AF. Very strange, especially as this isn't a named range at all. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
I am hiding columns within a range, and those columns are the values section
of a pivot table. It seems to be affecting a different range, depending on the number of columns in the pivot table, even though the named range is set to the values section. It's very strange. Would you mind if I emailed you an example of the problem? |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
Sure - probably tomorrow when I reply, but I'll reply direct to you.
Paul On Apr 28, 4:06*pm, malcomio wrote: I am hiding columns within a range, and those columns are the values section of a pivot table. It seems to be affecting a different range, depending on the number of columns in the pivot table, even though the named range is set to the values section. It's very strange. Would you mind if I emailed you an example of the problem? |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding columns in a named range
try this
Sub hidecolinrng() 'Range("hiderng").Cells(1, 3).EntireColumn.Hidden = False Range("hiderng").Range(Cells(1, 3), Cells(1, 4)).EntireColumn.Hidden = True 'FALSE End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "malcomio" wrote in message ... Is there a way of hiding columns in named ranges in VBA? I've got a load of columns that I want to show and hide, but I might want to add other columns in the worksheets later, so named ranges would make life easier. I would have thought it was simple, but I just get an error that I'm "unable to set hidden property of range class" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unhide columns in named range | Excel Programming | |||
Hiding rows that are included in a named range | Excel Programming | |||
How can I hide a range of columns without hiding charts there? | Charts and Charting in Excel | |||
Named Range - Empty columns | Excel Programming | |||
Hiding Blank lines in named range | Excel Programming |