Button hides unhides columns, how?

J

JimH

I inherited a workbook where in some tabs buttons are used to hide and unhide
columns. These buttons appear above the column headers and are labeled with
the + sign. When clicked several columns are unhidden and a button appears
with a "-" sign. Clicking this button in turn rehides the columns. How is
this done? Are these command buttons? How are they inserted above the
column headers? I've not been able to figure out how to see the code behind
the buttons. Any guidance will be greatly appreciated.
 
D

Duke Carey

check in Help for Group and UnGroup. This is an option accessible off the
Data menu
 
P

PCLIVE

Try this for example:

Create a Macro with the following (probably a little unorthodox, but it
works)


Sub HideUnhideSheet()
If Sheets("Sheet2").Visible = False Then GoTo FalseHide Else GoTo
TrueUnhide

FalseHide:
Sheets("Sheet2").Visible = True
Sheets("Sheet2").Activate
End

TrueUnhide:
Sheets("Sheet2").Visible = False
Sheets(1).Activate

End Sub


Then:
Goto View-Toolbars-Customize
Click 'New'
Give your new Toolbar a name and click OK
With your new Customer Toolbar highlighted, click the Commands tab.
Scroll down and select, say, 'Macros' and then drag the Custom Button face
to your new Toolbar.
Then right-click on your new Toolbar button and select 'Assign Macro'.
Select the Macro that you just created and click OK.
Click Close on the Customize window.
You may have to exit Design Mode at this point.
Your button is now created and ready to use.

I'm sure there are other ways of doing this, but this works.
 

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