macro to hide/unhide columns

G

Guest

I need to hide and unhide columns in a spreadsheet. My problem is that
different sets of columns are being hidden depending on the data I need. I
can create a basic macro, but can't seem to get it to work when I select more
than one column (either a range or non consecutive sets [i.e. columns C and E
or C,D, and F, etc]).

Any suggestions?
 
D

Die_Another_Day

I have an addin that does this. Would you like me to email it to you?

Charles Chickering
xl Geek
 
B

Bob Phillips

For Each col In Selection.Columns
col.Hidden = True
Next col

will hide them, but how will you select hidden columns?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Guest

My thought was that I could select all the columns in my spreadsheet and run
the macro to unhide columns. This should unhide all columns. This is what I
need anyway, because I would need to select a new set of columns to hide for
the next step in my process.

Can or should I turn your macro statement into an if/then statement?

Bob Phillips said:
For Each col In Selection.Columns
col.Hidden = True
Next col

will hide them, but how will you select hidden columns?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Monique said:
I need to hide and unhide columns in a spreadsheet. My problem is that
different sets of columns are being hidden depending on the data I need. I
can create a basic macro, but can't seem to get it to work when I select more
than one column (either a range or non consecutive sets [i.e. columns C and E
or C,D, and F, etc]).

Any suggestions?
 
D

Die_Another_Day

Once all columns are selected press Ctrl+Shift+) to unhide all columns.

Charles Chickering
xl Geek
My thought was that I could select all the columns in my spreadsheet and run
the macro to unhide columns. This should unhide all columns. This is what I
need anyway, because I would need to select a new set of columns to hide for
the next step in my process.

Can or should I turn your macro statement into an if/then statement?

Bob Phillips said:
For Each col In Selection.Columns
col.Hidden = True
Next col

will hide them, but how will you select hidden columns?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Monique said:
I need to hide and unhide columns in a spreadsheet. My problem is that
different sets of columns are being hidden depending on the data I need. I
can create a basic macro, but can't seem to get it to work when I select more
than one column (either a range or non consecutive sets [i.e. columns C and E
or C,D, and F, etc]).

Any suggestions?
 
G

Guest

PERFECT!!!!!
Thanks to both of you for the help.

Die_Another_Day said:
Once all columns are selected press Ctrl+Shift+) to unhide all columns.

Charles Chickering
xl Geek
My thought was that I could select all the columns in my spreadsheet and run
the macro to unhide columns. This should unhide all columns. This is what I
need anyway, because I would need to select a new set of columns to hide for
the next step in my process.

Can or should I turn your macro statement into an if/then statement?

Bob Phillips said:
For Each col In Selection.Columns
col.Hidden = True
Next col

will hide them, but how will you select hidden columns?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

I need to hide and unhide columns in a spreadsheet. My problem is that
different sets of columns are being hidden depending on the data I need.
I
can create a basic macro, but can't seem to get it to work when I select
more
than one column (either a range or non consecutive sets [i.e. columns C
and E
or C,D, and F, etc]).

Any suggestions?
 

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