Excel

M

Mary Contrary

How to insert button on spreadsheet to quickly hide & unhide a group of columns
 
D

Don Guillett

Sub togglehidecols()
Columns(2).Resize(, 4).Hidden = _
Not Columns(2).Resize(, 4).Hidden
End Sub
 
G

Gord Dibben

Add a button from the Forms Toolbar and assign this macro.

Sub toggle_columns()
Dim rng As Range
Set rng = Columns("D:I")
If rng.Hidden = True Then
rng.Hidden = False
Else
rng.Hidden = True
End If
End Sub

Note: Excel also has the "Custom Views" feature which requires no macro.

Simply switch from one View to the other.


Gord Dibben MS Excel MVP

On Fri, 22 Jan 2010 13:07:01 -0800, Mary Contrary <Mary
 
C

CellShocked

Is that a special application assistant's function? :)

darn<> dang<> dagnabbit<> crikey<> beatmetoit<>
 
G

Gord Dibben

Was supposed to be Oh, darn<g>

meaning.............why didn't I think of that?


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