Multiple column filtering

  • Thread starter Thread starter faraz316
  • Start date Start date
F

faraz316

Hi,

I am trying to group multiple non-consecutive columns so that all columns
can be hidden and each group can be displayed.

I have 40 columns with multiple rows on a worksheet and want to set up
vertical groupings i.e. group columns (A, D, G, J ....) together, and then
(B, E, H, K... together), and so on - final result is that all columns can be
hidden and each 'group' can be displayed on its own. I know that rows can be
grouped together using the 'Group' function but am not sure of columns. Does
anyone know if this can be done on Excel?
 
You can't put non-contiguous columns in the same group. You could use macros
to hide/show multiple selected columns, as follows:

Sub HideGroup1()
Range("B:B,D:D,G:G,J:J").Select
Selection.EntireColumn.Hidden = True
End Sub

Sub ShowGroup1()
Range("B:B,D:D,G:G,J:J").Select
Selection.EntireColumn.Hidden = False
End Sub

The macros could be called from command buttons on the worksheet, keystroke
combinations, a custom toolbar, etc.

If you are new to macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/

Hope this helps,

Hutch
 
Hi,

You can use this macro to toggle the groups on and off:

Sub ToggleGroup()
Range("B:B,D:D,G:G,J:J").Columns.Hidden = not
Range("B:B,D:D,G:G,J:J").Columns.Hidden
End Sub
 
Back
Top