Filter/Hide

N

Neil Pearce

Autofilter can hide rows. Is there a way to hide columns based on the inputs
of a particular row?

i.e. columns E-Z contain information to be filtered, if cells in row 6
contain either a 0 or 1, is it possible to hide the columns containing 0?


Thanking-you in advance,

Neil
 
P

Pete_UK

There is no native way in Excel to hide columns based on some value,
so you would need a macro to do this for you.

Pete
 
D

Dave Peterson

Maybe you'd settle on grouping the columns--but this is a manual effort to apply
and to use.

In xl2003 menus:
Select the columns
Data|Group and Outline|Group
 
G

Gord Dibben

Filtering won't work across columns.

You would need VBA to hide columns with zeros.

Sub Hide_Zeros_Cols()
Dim Rngrow As Range
Dim I As Range
Application.ScreenUpdating = False
Range("A6").Select
Set Rngrow = Range(ActiveCell, Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft))
For Each I In Rngrow
If I.Value = 0 Then _
I.EntireColumn.Hidden = True
Next I
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP
 
G

Gord Dibben

Without the "select"

Sub Hide_Zeros_Cols()
Dim Rngrow As Range
Dim rng1 As Range
Dim I As Range
Application.ScreenUpdating = False
Set rng1 = Cells(6, 1)
Set Rngrow = Range(rng1, Cells(rng1.Row, _
Columns.Count).End(xlToLeft))
For Each I In Rngrow
If I.Value = 0 Then _
I.EntireColumn.Hidden = True
Next I
Application.ScreenUpdating = True
End Sub


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top