Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Command Button to Show/Hide the Shaded Headers Columns
How do I code a Toggle Command Button to Show or Hide all Columns
which headers are shaded ? Thank you, Celeste |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Command Button to Show/Hide the Shaded Headers Columns
Not sure where your commandbutton will be located... but here is some code
you can apply to it... If you embed a commandbutton on the worksheet, the first thing that should pop up is what macro you want to assign to it. Here is what I would do: 1. Copy the macro below 2. Open your Excel file 3. Hit ALT + F11 to open the VBE 4. Insert a new module 5. Paste the code (shown below) 6. Go to the worksheet you want this commandbutton on 7. Insert/Embed your command button 8. Use the pop up to assign it to the new macro Mark Ivey Sub HideColumnsWithShadedHeaderCells() Dim myRange As Range For i = 1 To 256 Set myRange = Cells(1, i) If myRange.Interior.ColorIndex < xlNone Then myRange.EntireColumn.Hidden = True End If Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command Button to show/hide a different worksheet | Excel Discussion (Misc queries) | |||
Toggle Button in Ribbon to Hide/Show Built-in Tabs | Excel Programming | |||
using a toggle button to show or hide information in several cells | Excel Worksheet Functions | |||
Using Command Button to Hide Columns in another worksheet | Excel Programming | |||
hide and show columns using one control button | Excel Programming |