How to use button to show hide columns in Excel?
This article will show you methods of creating and using button to show and hide columns in Excel.
Use button to show hide columns with Toggle button
Use button to show hide columns with Kutools for Excel
Use button to show hide columns with Toggle button
You can create a Toggle button to show hide columns by clicking it. Please do as follows.
1. Click Developer > Insert > Toggle Button (ActiveX Control). See screenshot:
Note: If you don’t see the Developer tab on the Ribbon, please click show/display developer tab in Excel to know how to enable it.
2. Draw a Toggle button on the worksheet. Right click it, and then select View Code from the right-clicking menu. See screenshot:
3. In the opened Microsoft Visual Basic Applications window, replace all content in the code window with below VBA code.
VBA code: button to show hide columns
Private Sub ToggleButton1_Click()
Dim xAddress As String
xAddress = "F:G"
If ToggleButton1.Value Then
Application.ActiveSheet.Columns(xAddress).Hidden = True
Else
Application.ActiveSheet.Columns(xAddress).Hidden = False
End If
End Sub
Note: “F:G” in the code means that columns F:G will be show and hide while running the code. Please change them to your needs.
4. Press Alt + Q keys simultaneously to close the Microsoft Visual Basic Applications window.
5. Turn off the Design Mode with clicking Developer > Design Mode.
Now when you click the toggle button, the specified columns are hidden immediately.
While click it again, the columns are displayed.
Use button to show hide columns with Kutools for Excel
If there already have columns hided in your worksheet, Kutools for Excel’s Toggle to unhide / hide all hidden column(s) utility can help you to quickly show and hide them with just one click.
Before applying Kutools for Excel, please download and install it firstly.
1. Click Kutools > Navigation.
2. Shift to the Column list pane, and then you can click the Toggle to unhide / hide all hidden column(s) button to show/hide columns in current worksheet.
If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.
Use button to show hide columns with Kutools for Excel
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!