ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excel (https://www.excelbanter.com/excel-worksheet-functions/254173-excel.html)

Mary Contrary

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

Don Guillett[_2_]

Excel
 

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mary Contrary" <Mary
wrote in message
...
How to insert button on spreadsheet to quickly hide & unhide a group of
columns



Gord Dibben

Excel
 
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
wrote:

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



Gord Dibben

Excel
 
Oh, darn<


Gord

On Fri, 22 Jan 2010 15:32:42 -0600, "Don Guillett"
wrote:


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



Don Guillett[_2_]

Excel
 
There are lots of things I have learned from your posts.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Oh, darn<


Gord

On Fri, 22 Jan 2010 15:32:42 -0600, "Don Guillett"
wrote:


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




CellShocked

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

darn< dang< dagnabbit< crikey< beatmetoit<



On Fri, 22 Jan 2010 14:48:33 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Oh, darn<


Gord

On Fri, 22 Jan 2010 15:32:42 -0600, "Don Guillett"
wrote:


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


Gord Dibben

Excel
 
Was supposed to be Oh, darn<g

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


Gord

On Sat, 23 Jan 2010 10:16:16 -0800, CellShocked
<cellshocked@thecellvalueattheendofthespreadsheet. org wrote:

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

darn< dang< dagnabbit< crikey< beatmetoit<



On Fri, 22 Jan 2010 14:48:33 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Oh, darn<


Gord

On Fri, 22 Jan 2010 15:32:42 -0600, "Don Guillett"
wrote:


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



CellShocked

Excel
 
On Sat, 23 Jan 2010 10:23:42 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Was supposed to be Oh, darn<g

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


Gord


Or dang<f for "frown". in the case of a 'beatmetoit' occurrence.



On Sat, 23 Jan 2010 10:16:16 -0800, CellShocked
<cellshocked@thecellvalueattheendofthespreadsheet .org wrote:

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

darn< dang< dagnabbit< crikey< beatmetoit<



On Fri, 22 Jan 2010 14:48:33 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Oh, darn<


Gord

On Fri, 22 Jan 2010 15:32:42 -0600, "Don Guillett"
wrote:


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



All times are GMT +1. The time now is 08:22 AM.

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