How to hide columns on multiple sheets in a workbook?
In Excel, we can quickly hide columns in one worksheet, but, have you ever tried to hide columns across multiple sheets at once? Normally, you may try to select all sheets and apply the Hide feature, but it will not work successfully. This article, I will talk about how to hide columns across multiple worksheets quickly?
The following code can help you to hide specific columns across all worksheets immediately, please do as this:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Hide columns on multiple sheets at once:
Sub Hide_Columns() 'Updateby Extendoffice Dim iWs As Integer Dim sCol As String On Error Resume Next sCol = Application.InputBox("Input entire column,Eg A:A OR A:B", _ "Kutools for Excel", , , , , , 2) If sCol = "" Then MsgBox "Empty columns", vbInformation, "Kutools for Excel" Exit Sub End If For iWs = 1 To ThisWorkbook.Worksheets.Count ThisWorkbook.Sheets(iWs).Columns(sCol).Hidden = True Next iWs On Error GoTo 0 End Sub
3. Then press F5 key to run this code, and a prompt box is popped out to remind you type the columns that you want to hide across all worksheets, see screenshot:
4. And then click OK button, your specified columns have been hidden in all worksheets at once.
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
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! (Full-Featured 30-Day Free Trial)