ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Multiple column filtering (https://www.excelbanter.com/excel-worksheet-functions/235368-multiple-column-filtering.html)

faraz316

Multiple column filtering
 
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?

Tom Hutchins

Multiple column filtering
 
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/200...e-elses-macro/

Hope this helps,

Hutch

"faraz316" wrote:

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?


Shane Devenshire[_2_]

Multiple column filtering
 
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

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"faraz316" wrote:

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?



All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com